text:
package org.smurn.jsift;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Represents a scale interval in the scale-space where the scale doubles.
 *
All images in an octave have the same width and height.

 */
public final class Octave {

    private final List<Image> scaleImages;
    private final List<Image> doGs;
    private static final int ADDITIONAL_SCALES = 2;

    /**
     * Creates an instance.
     * @param scaleImages Scale-images.
     * @param doGs Difference-of-gaussian images.
     * @throws NullPointerException if one of the parameters is {@code null}.
     * @throws IllegalArgumentException if there are not at least four scale
     * images, if the number of Difference-of-gaussian images is not one less
     * than the number of scale-images, if not all images are of equal width and
     * height.
     * or if {@code baseScale} is not strictly positive.
     */
    public Octave(final List<Image> scaleImages,
            final List<Image> doGs) {
        if (scaleImages == null) {
            throw new NullPointerException("scaleImages must not be null");
        }
        if (doGs == null) {
            throw new NullPointerException("scaleImages must not be null");
        }
        if (scaleImages.size() < ADDITIONAL_SCALES + 2) {
            throw new IllegalArgumentException(
                    "Need at least four scale-images.");
        }
        if (doGs.size() != scaleImages.size() - 1) {
            throw new IllegalArgumentException(
                    "Need exactly one DoG image less than scale-images");
        }
        int width = scaleImages.get(0).getWidth();
        int height = scaleImages.get(0).getHeight();

        for (int i = 0; i < scaleImages.size(); i++) {
            Image image = scaleImages.get(i);
            if (image.getWidth() != width || image.getHeight() != height) {
                throw new IllegalArgumentException("scale-image " + i
                        + " has a different size than the first scale-image");
            }
        }

        for (int i = 0; i < doGs.size(); i++) {
            Image image = doGs.get(i);
            if (image.getWidth() != width || image.getHeight() != height) {
                throw new IllegalArgumentException("DoG image " + i
                        + " has a different size than the first scale-image");
            }
        }

        this.scaleImages = Collections.unmodifiableList(
                new ArrayList<Image>(scaleImages));
        this.doGs = Collections.unmodifiableList(new ArrayList<Image>(doGs));
    }

    /**
     * Gets the number of scales per octave.
     * @return Number of scales per octave.
     */
    public int getScalesPerOctave() {
        return scaleImages.size() - ADDITIONAL_SCALES - 1;
    }

    /**
     * Gets the scale-image at the scales of this octave.
     * Each image's scale is {@code b*2^(i/s)} where
     * {@code s=getScalesPerOctave()}, {@code b=getBaseScale()}.
     * @return Immutable list with {@code getScalesPerOctave()+3} images.
     */
    public List<Image> getScaleImages() {
        return scaleImages;
    }

    /**
     * Gets the difference-of-gaussian images of this octave.
     * The image with index {@code i} is the difference from the scale-image
     * with index {@code i+1} and {@code i}.
     * Each image's scale is {@code b*2^((i+0.5)/s)} where
     * {@code s=getScalesPerOctave()}, {@code b=getBaseScale()}.
     * @return Immutable list with {@code getScalesPerOctave()+2} images.
     */
    public List<Image> getDifferenceOfGaussians() {
        return doGs;
    }

    /**
     * Gets the width of all images (both scale and DoG) in this octave.
     * @return Width of all images in this octave.
     */
    public int getWidth() {
        return scaleImages.get(0).getWidth();
    }

    /**
     * Gets the height of all images (both scale and DoG) in this octave.
     * @return Height of all images in this octave.
     */
    public int getHeight() {
        return scaleImages.get(0).getHeight();
    }
}


text:
export LD_LIBRARY_PATH=../../lib:$LD_LIBRARY_PATH
./a.out 4

redpajama_set_name: RedPajamaGithub


text:
import { Component } from '@angular/core';

@Component({
    moduleId: module.id,
    selector: 'structural-directives',
    templateUrl: 'structural-directives.component.html',
    styles: ['button { min-width: 100px; }']
})
export class StructuralDirectivesComponent {
    heroes = ['Mr. Nice', 'Narco', 'Bombasto'];
    hero = this.heroes[0];
    condition = true;
    isVisible = true;
    logs: string[] = [];
    status = 'ready';
}


text:
    mkdir nil/
    touch nil
    gcf push my-standalone-demo -i 1 -m 64M -b https://github.com/wwy/buildpack-bash

    curl http://my-standalone-demo.cfapps.io


text:
<?php

namespace webloja\WeblojaBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class MenuControllerTest extends WebTestCase
{
}


text:
package edu.harvard.we99.services;

import edu.harvard.we99.domain.Experiment;
import edu.harvard.we99.domain.Plate;
import edu.harvard.we99.domain.PlateDimension;
import edu.harvard.we99.domain.Protocol;
import edu.harvard.we99.domain.lists.Experiments;
import edu.harvard.we99.domain.lists.Plates;
import edu.harvard.we99.domain.lists.Users;
import edu.harvard.we99.domain.results.ResultStatus;
import edu.harvard.we99.domain.results.StatusChange;
import edu.harvard.we99.security.User;
import edu.harvard.we99.services.experiments.ExperimentResource;
import edu.harvard.we99.services.experiments.MemberResource;
import edu.harvard.we99.test.DisableLogging;
import edu.harvard.we99.test.LogTestRule;
import edu.harvard.we99.test.Scrubbers;
import edu.harvard.we99.util.ClientFactory;
import org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver;
import org.apache.cxf.phase.PhaseInterceptorChain;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import java.net.URL;

import static edu.harvard.we99.test.BaseFixture.assertJsonEquals;
import static edu.harvard.we99.test.BaseFixture.assertOk;
import static edu.harvard.we99.test.BaseFixture.load;
import static edu.harvard.we99.test.BaseFixture.name;
import static edu.harvard.we99.util.JacksonUtil.toJsonString;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

/**
 * @author mford
 */
public class ExperimentServiceST {
    @Rule
    public LogTestRule logTestRule = new LogTestRule();

    private static ExperimentService es;
    private static PlateTypeService pts;
    private static ProtocolService ps;
    private static User user;
    private static PlateResultsFixture resultsFixture;
    private Experiment xp;

    @BeforeClass
    public static void init() throws Exception {
        URL url = new URL(WebAppIT.WE99_URL);
        ClientFactory cf = new ClientFactory(url, WebAppIT.WE99_EMAIL, WebAppIT.WE99_PW);

        es = cf.create(ExperimentService.class);
        user = cf.create(UserService.class).list(null, null, "we99.2015@example").getValues().get(0);
        pts = cf.create(PlateTypeService.class);
        ps = cf.create(ProtocolService.class);
        resultsFixture = new PlateResultsFixture(new PlateDimension(10,10));
    }

    @AfterClass
    public static void tearDown() throws Exception {
        es = null;
        user = null;
        resultsFixture = null;
        pts = null;
    }

    @Before
    public void setUp() throws Exception {
        xp = es.create(
                new Experiment(name("Experiment")).setProtocol(new Protocol(name("p")))
        );
    }

    @Test
    public void typeAhead() throws Exception {
        Experiments experiments = es.listExperiments(null, null, xp.getName());
        assertEquals(1, experiments.size());
    }

    @Test
    public void listPlates() throws Exception {
        addPlateToExperiment();
        addPlateToExperiment();

        Plates list = es.getExperiment(xp.getId()).getPlates().list(null, null, null);
        assertJsonEquals(load("/ExperimentServiceST/list.json"),
                toJsonString(list), Scrubbers.pkey.andThen(Scrubbers.iso8601.andThen(Scrubbers.uuid)).andThen(Scrubbers.xpId));
    }

    @Test
    public void deletePlate() throws Exception {
        addPlateToExperiment();
        Plate p = addPlateToExperiment();

        Plates list = es.getExperiment(xp.getId()).getPlates().list(null, null, null);
        assertEquals(2, list.size());

        es.getExperiment(xp.getId()).getPlates().getPlates(p.getId()).delete();

        list = es.getExperiment(xp.getId()).getPlates().list(null, null, null);
        assertEquals(1, list.size());
    }

    @Test
    public void addMember() throws Exception {
        MemberResource mr = es.getExperiment(xp.getId()).getMembers();
        Response response = mr.addMember(user.getId());
        assertOk(response);

        Users members = mr.listMembers();
        assertThat(members.getValues()).extracting("email").containsExactly("we99.2015@example", "we99.2015@gmail.com");
    }

    @Test
    public void removeMember() throws Exception {
        MemberResource mr = es.getExperiment(xp.getId()).getMembers();
        Response response = mr.addMember(user.getId());
        assertOk(response);
        response = mr.removeMember(user.getId());
        assertOk(response);

        Users members = mr.listMembers();
        assertThat(members.getValues()).extracting("email").containsExactly("we99.2015@gmail.com");
    }

    @Test
    public void delete() throws Exception {
        Long id = xp.getId();
        Response r = es.getExperiment(id).delete();
        assertEquals(200, r.getStatus());
    }

    @Test
    public void published_are_immutable() throws Exception {
        // create experiment
        // create plate
        // import results
        // publish
        // assert we can't make a change
        Plate plate = addPlateToExperiment();

        ExperimentResource experimentResource = es.getExperiment(xp.getId());
        experimentResource.publish();

        // should not be able to make changes now
        try {
            DisableLogging.turnOff(PhaseInterceptorChain.class, AbstractFaultChainInitiatorObserver.class);
            experimentResource.getPlates().getPlates(plate.getId())
                    .getPlateResult()
                    .updateStatus(
                            new StatusChange(0, 0, ResultStatus.EXCLUDED));
            fail("expected the experiment to be locked");
        } catch (WebApplicationException e) {
            assertEquals(403, e.getResponse().getStatus());
        } finally {
            DisableLogging.restoreAll();
        }
    }

    @Test
    public void experimentVisibility() throws Exception {
        // main user creates an experiment, guest user can't see it
        addPlateToExperiment();

        URL url = new URL(WebAppIT.WE99_URL);
        ClientFactory cf = new ClientFactory(url, "we99.2015@example", WebAppIT.WE99_PW);
        ExperimentService guestExperimentService = cf.create(ExperimentService.class);
        Experiments experiments = guestExperimentService.listExperiments(null, null, null);
        // gues user cannot see the experiment
        assertThat(experiments.getValues()).extracting("id").doesNotContain(xp.getId());

        // main user publishes the experiment, guest user can see it now
        ExperimentResource experimentResource = es.getExperiment(xp.getId());
        experimentResource.publish();

        experiments = guestExperimentService.listExperiments(null, null, null);
        // gues user CAN see the experiment
        assertThat(experiments.getValues()).extracting("id").contains(xp.getId());
    }

    @Test
    public void update_existingProtocol() throws Exception {
        Protocol protocol = ps.create(new Protocol(name("foo")));
        ExperimentResource er = es.getExperiment(xp.getId());
        Experiment updated = er.update(xp.setProtocol(protocol));
        assertEquals(protocol.getName(), updated.getProtocol().getName());
    }

    @Test
    public void update_newProtocol() throws Exception {
        ExperimentResource er = es.getExperiment(xp.getId());
        Protocol foo = new Protocol(name("foo"));
        Experiment updated = er.update(xp.setProtocol(foo));
        assertEquals(foo.getName(), updated.getProtocol().getName());
    }

    private Plate addPlateToExperiment() {
        String plateTypeName = pts.listAll(null, null, null).getValues().get(0).getName();
        ExperimentResource experimentResource = es.getExperiment(xp.getId());
        PlateUtils.createPlateFromCSV(xp.getId(), name("plateName"), plateTypeName,
                getClass().getResourceAsStream("/ExperimentServiceST/plate.csv"));
        Plate plate = experimentResource.getPlates().list(null, null, null).getValues().get(0);
        Response r = resultsFixture.postResults(plate, "/ExperimentServiceST/results.csv");
        assertEquals(200, r.getStatus());
        return plate;
    }
}


text:
/// <reference path="fourslash.ts"/>

//// function foo() {
////     function getOccurrencesAtPosition() {
////         switch (node) {
////             enum /*1*/
////         }
////
////         return undefined;
////
////         function keywordToReferenceEntry() {
////         }
////     }
////
////     return {
////         getEmitOutput: (filename): Bar => null,
////     };
//// }

// Force a syntax tree ot be created.
verify.noMatchingBracePositionInCurrentFile(0);

// make sure we check the tree after every edit.
diagnostics.setTypingFidelity(TypingFidelity.High);
goTo.marker('1');
edit.insert('Fo');


text:
<?php
/**
 * @package WordPress
 * @subpackage Constructor
 *
 * Don't work preview on admin page?
 * Read issue 11006 for more details
 *
 * @see      http://core.trac.wordpress.org/ticket/11006
 *
 * @author   Anton Shevchuk <AntonShevchuk@gmail.com>
 * @link     http://anton.shevchuk.name
 */
// need for defence
define('CONSTRUCTOR', true);

// debug only current theme
define('CONSTRUCTOR_DEBUG', false);

define('CONSTRUCTOR_DIRECTORY',     get_template_directory());
define('CONSTRUCTOR_DIRECTORY_URI', get_template_directory_uri());

define('CONSTRUCTOR_DEFAULT_THEMES', CONSTRUCTOR_DIRECTORY.'/themes');
define('CONSTRUCTOR_DEFAULT_THEMES_URI', CONSTRUCTOR_DIRECTORY_URI.'/themes');

$wp_upload = wp_upload_dir();

define('CONSTRUCTOR_CUSTOM_CONTENT',  $wp_upload['basedir'].'/constructor');
define('CONSTRUCTOR_CUSTOM_CACHE',    CONSTRUCTOR_CUSTOM_CONTENT.'/cache');
define('CONSTRUCTOR_CUSTOM_IMAGES',   CONSTRUCTOR_CUSTOM_CONTENT.'/images');
define('CONSTRUCTOR_CUSTOM_THEMES',   CONSTRUCTOR_CUSTOM_CONTENT.'/themes');

define('CONSTRUCTOR_CUSTOM_CONTENT_URI', $wp_upload['baseurl'].'/constructor');
define('CONSTRUCTOR_CUSTOM_CACHE_URI',   CONSTRUCTOR_CUSTOM_CONTENT_URI.'/cache');
define('CONSTRUCTOR_CUSTOM_IMAGES_URI',  CONSTRUCTOR_CUSTOM_CONTENT_URI.'/images');
define('CONSTRUCTOR_CUSTOM_THEMES_URI',  CONSTRUCTOR_CUSTOM_CONTENT_URI.'/themes');

load_theme_textdomain('constructor', CONSTRUCTOR_DIRECTORY.'/lang');

// support features
if (function_exists('add_theme_support')) { // Added in 2.9
	// This theme uses post thumbnails
	add_theme_support('post-thumbnails' );
	set_post_thumbnail_size(64, 64, true); // Normal post thumbnail
	add_image_size('list-post-thumbnail', 128, 128, true );
	add_image_size('tile-post-thumbnail', 320, 320, true );

	// This theme uses wp_nav_menu()
	add_theme_support('menus');

	// Add default posts and comments RSS feed links to head
	add_theme_support('automatic-feed-links');
}

// sidebar registration
if (function_exists('register_sidebar')) {

    register_sidebar(array(
        'id'=>'header',
        'name'=>'Top Menu',
        'before_widget' => '
',
        'after_widget' => '
',
        'before_title' => '',
        'after_title' => '',
    ));

    register_sidebar(array(
        'id'=>'content',
        'name'=>'After N Post',
        'before_widget' => '
',
        'after_widget' => '
',
        'before_title' => '
',
        'after_title' => '
',
    ));

    register_sidebar(array(
        'id'=>'incontent',
        'name'=>'In Posts',
        'before_widget' => '
',
        'after_widget' => '
',
        'before_title' => '
',
        'after_title' => '
',
    ));

    // options for all follows sidebars
    $widget_options = array(
        'before_widget' => '
',
        'after_widget' => '
',
        'before_title' => '
',
        'after_title' => '
',
    );

    register_sidebar(array_merge($widget_options, array('id'=>'sidebar','name'=>'Sidebar')));
    register_sidebar(array_merge($widget_options, array('id'=>'sidebar-categories', 'name'=>'Sidebar for Categories')));
    register_sidebar(array_merge($widget_options, array('id'=>'sidebar-posts', 'name'=>'Sidebar for Posts')));
    register_sidebar(array_merge($widget_options, array('id'=>'sidebar-pages', 'name'=>'Sidebar for Pages')));

    register_sidebar(array_merge($widget_options, array('id'=>'extra','name'=>'Extrabar')));
    register_sidebar(array_merge($widget_options, array('id'=>'extra-categories','name'=>'Extrabar for Categories')));
    register_sidebar(array_merge($widget_options, array('id'=>'extra-posts','name'=>'Extrabar for Posts')));
    register_sidebar(array_merge($widget_options, array('id'=>'extra-pages','name'=>'Extrabar for Pages')));

    register_sidebar(array_merge($widget_options, array('id'=>'footer', 'name'=>'Footer')));
    register_sidebar(array_merge($widget_options, array('id'=>'footer-categories', 'name'=>'Footer for Categories')));
    register_sidebar(array_merge($widget_options, array('id'=>'footer-posts', 'name'=>'Footer for Posts')));
    register_sidebar(array_merge($widget_options, array('id'=>'footer-pages', 'name'=>'Footer for Pages')));
}

// navigation menu
if (function_exists('register_nav_menu')) {
    register_nav_menu('header', __('Header Menu','constructor'));
}

if (!is_admin()) {

    /**
     * Parse request
     *
     * @param unknown_type $wp
     */
    function constructor_parse_request($wp) {
        // only process requests with "my-plugin=ajax-handler"
        if (array_key_exists('theme-constructor', $wp->query_vars)){
            switch ($wp->query_vars['theme-constructor']) {
                case 'css':
                    require_once 'css.php';
                    break;
                case 'slideshow':
                    require_once 'slideshow.php';
                    break;
            }
            // die after return data
            die();
        } elseif (array_key_exists('preview', $wp->query_vars)) {
            global $postfix;

        }
    }
    add_action('wp', 'constructor_parse_request');

    /**
     * register query vars
     *
     * @param array $vars
     * @return array
     */
    function constructor_query_vars($vars) {
        $vars[] = 'theme-constructor';
        return $vars;
    }
    add_filter('query_vars', 'constructor_query_vars');

    /**
     * Preview filter
     *
     * @param string $content
     * @return string
     */
    function constructor_preview($content) {
        $link = add_query_arg(array('preview' => 1, 'template' => get_template()), '?theme-constructor=css');

        $content = str_replace('?theme-constructor=css', $link, $content);
        return $content;
    }

    add_filter('preview_theme_ob_filter', 'constructor_preview');

    require_once CONSTRUCTOR_DIRECTORY .'/libs/Constructor/Main.php';
    require_once CONSTRUCTOR_DIRECTORY .'/libs/Constructor/Shortcodes.php';

    $main = new Constructor_Main();
    $main -> init();

    /**
     * It's really bad practices, don't use globals
     * You should be create setter for this is function
     */
    if (!isset($content_width)) {
        $content_width = $main->getContentWidth() - 24;
    }

    /* Alias section for fast theme development */

    /**
     * get_constructor_option
     *
     * @param  string $section
     * @param  string $key1
     * @param  string $key2
     * @return mixed
     */
    function get_constructor_option($section, $key1, $key2 = null)
    {
        global $main;
        return $main->getOption($section, $key1, $key2);
    }
    /**
     * get_constructor_slideshow
     *
     * @access  public
     * @param   boolean  $in In or Out of content container
     * @return  rettype  return
     */
    function get_constructor_slideshow($in = false)
    {
        global $main;
        $main->getSlideshow($in);
    }

    /**
     * get_constructor_layout
     *
     * return layout by admin options for $where
     *
     * @param  string $where
     * @return string
     */
    function get_constructor_layout($where = 'index')
    {
        global $main;
        $main->getLayout($where);
    }

    /**
     * get_constructor_class
     *
     * return default layout class
     *
     * @param  string $rewrite
     * @return string
     */
    function the_constructor_layout_class($rewrite = null)
    {
        global $main;
        echo $main->getLayoutClass($rewrite);
    }

    /**
     * get top menu
     *
     * @param  string $before
     * @param  string $after
     * @return string
     */
    function get_constructor_menu($before = '', $after = '')
    {
        global $main;
        $main->getMenu($before, $after);
    }

    /**
     * get content widget
     *
     * @param integer $i post counter
     * @return void
     */
    function get_constructor_content_widget($i)
    {
        global $main;
        $main->getContentWidget($i);
    }

    /**
     * get author name
     *
     * @param  string $before
     * @param  string $after
     * @return string
     */
    function get_constructor_author($before = '', $after = '')
    {
        global $main;
        echo $main->getAuthor($before, $after);
    }

    /**
     * get avatar size
     *
     * @param integer $size
     * @return string
     */
    function get_constructor_avatar_size($size = 32)
    {
        global $main;
        return $main->getAvatarSize($size);
    }

    /**
     * get no image
     *
     * @param integer $width
     * @param integer $height
     * @param string $align
     * @return string
     */
    function get_constructor_noimage($width = 320, $height = 320, $align = 'none')
    {
        return '';
    }

    /**
     * get sidebar
     *
     * @access  public
     * @return  string
     */
    function get_constructor_sidebar()
    {
        global $main;
        $main->getSidebar();
    }

    /**
     * get navigation
     *
     * @access  public
     * @return  string
     */
    function get_constructor_navigation()
    {
        global $main;
        $main->getNavigation();
    }

    /**
     * get social bar
     *
     * @access  public
     * @return  string
     */
    function get_constructor_social()
    {
        global $main;
        $main->getSocial();
    }

    /**
     * get footer
     *
     * @access public
     * @return string
     */
    function get_constructor_footer()
    {
        global $main;
        $main->getFooter();
    }

    /**
     * get constructor category classname
     *
     * @return string
     */
    function get_constructor_category_class()
    {
        global $main;
        return $main->getCategoryClass();
    }

    /**
     * get constructor category
     *
     * @return string
     */
    function get_constructor_category()
    {
        global $main;
        return $main->getCategory();
    }

    /**
     * load empty search template
     */
    function get_constructor_nothing()
    {
        include_once 'nothing.php';
    }

} else {
    require_once 'admin/admin.php';
}


text:
<?php

namespace CorsDemo;

class ProtocolChecker
{
	const HTTP  = 'http';
	const HTTPS = 'https';

	/**
	 * @var \Slim\Slim
	 */
	private $app;

	public function __construct(\Slim\Slim $app)
	{
		$this->app = $app;
	}

	public function check(\Slim\Route $route)
	{
		$protocol = $this->app->request->getScheme();

		switch ($route->getName()) {
			case 'index':
				if ($protocol !== self::HTTP) {
					$this->handleInvalidProtocol();
				}
				break;
			case 'login':
				if ($protocol !== self::HTTPS) {
					$this->handleInvalidProtocol();
				}
				break;
			case 'get-data':
				if ($protocol !== self::HTTPS) {
					$this->handleInvalidProtocol();
				}
				break;
		}
	}

	private function handleInvalidProtocol()
	{
		$this->app->halt(426, 'Invalid protocol!');
	}
}


text:
//Problem 10. Employee Data

//A marketing company wants to keep record of its employees. Each record would have the following characteristics:

//First name
//Last name
//Age (0...100)
//Gender (m or f)
//Personal ID number (e.g. 8306112507)
//Unique employee number (27560000…27569999)
//Declare the variables needed to keep the information for a single employee using appropriate primitive data types. Use descriptive names. Print the data at the console.

using System;
using System.Collections.Generic;
using System.Linq;

class Employees
{
    static void Main()
    {

        IEnumerable<int> employeeNumber = Enumerable.Range(27560001, 99999);

            foreach (int number in employeeNumber)
            {

                    Console.WriteLine("Enter first name of employee:");
                    string firstName = Console.ReadLine();

                    Console.WriteLine("Enter last name of employee:");
                    string lastName = Console.ReadLine();

                    Console.WriteLine("Enter age:");
                TryEnterAge:
                    string enterAge = Console.ReadLine();
                    byte age;
                    if (byte.TryParse(enterAge, out  age) && age < 100)
                    {
                    }
                    else
                    {
                        Console.WriteLine("Try again:");
                        goto TryEnterAge;
                    }

                    Console.WriteLine("Enter gender:");
                TryEnterGender:
                    string enterGender = Console.ReadLine();
                    char gender;
                    if(char.TryParse(enterGender, out  gender) && (gender == 'm' || gender == 'f'))
                    {
                    }
                    else
                    {
                        Console.WriteLine("You must enter \'f\' for female or \'m\' for male:");
                        goto TryEnterGender;
                    }

                    Console.WriteLine("Enter personal ID number:");
                TryEnterIDNumber:
                    string enterIdNumber = Console.ReadLine();
                    ulong personalId;
                    if (ulong.TryParse(enterIdNumber, out  personalId) && personalId <= 9999999999)
                    {
                    }
                    else
                    {
                        Console.WriteLine("Try again:");
                        goto TryEnterIDNumber;
                    }

                    Console.WriteLine("\n\t{0, -20} {1}", "Employees Number:", number);
                    Console.WriteLine("\t{0, -20} {1} {2}", "Name:", firstName, lastName);
                    Console.WriteLine("\t{0, -20} {1}", "Age:", age);
                    if (gender == 'm')
                    {
                        Console.WriteLine("\t{0, -20} {1}", "Gender:", "Male");
                    }
                    else
                    {
                        Console.WriteLine("\t{0, -20} {1}", "Gender:", "Female");
                    }
                    Console.WriteLine("\t{0, -20} {1}", "Personal ID:", personalId);

                    Console.WriteLine("\nFor exit press esc, to enter a new eployee press other button!!!");

                    ConsoleKeyInfo esc;
                    esc = Console.ReadKey(true);
                    if (esc.Key == ConsoleKey.Escape)
                    {
                        Console.WriteLine("To exit press esc again!");
                        goto Final;
                    }

            }
        Final:
            Console.ReadKey();

    }
}


text:
{-# LANGUAGE DataKinds                  #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE FlexibleInstances          #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses      #-}
{-# LANGUAGE OverloadedStrings          #-}
{-# LANGUAGE RankNTypes                 #-}
{-# LANGUAGE TypeSynonymInstances       #-}

-- | A bridge builder DSL, powered by 'Monad', 'Alternative' and lens.
--
--   Bridges can be built within the 'BridgeBuilder' monad.
--   You can check properties of the to-be-bridged 'HaskellType' with '^==' or 'doCheck',
--   you have choice ('<|>'), you can fail ('empty') and you can return a translated
--   'PSType' ('return'). The 'HaskellType' can be accessed with:
--
-- > view haskType
--
--   Find usage examples in "Language.PureScript.Bridge.Primitives" and "Language.PureScript.Bridge.PSTypes"
module Language.PureScript.Bridge.Builder (
  BridgeBuilder
, BridgePart
, FixUpBuilder
, FixUpBridge
, BridgeData
, fullBridge
, (^==)
, doCheck
, (<|>)
, psTypeParameters
, FullBridge
, buildBridge
, clearPackageFixUp
, errorFixUp
, buildBridgeWithCustomFixUp
) where

import           Control.Applicative
import           Control.Lens
import           Control.Monad                       (MonadPlus, guard, mplus,
                                                      mzero)
import           Control.Monad.Reader.Class
import           Control.Monad.Trans.Reader          (Reader, ReaderT (..),
                                                      runReader)
import           Data.Maybe                          (fromMaybe)
import           Data.Monoid ((<>))
import qualified Data.Text                           as T
import           Language.PureScript.Bridge.TypeInfo

newtype BridgeBuilder a =
  BridgeBuilder (ReaderT BridgeData Maybe a)
    deriving (Functor, Applicative, Monad, MonadReader BridgeData)

type BridgePart = BridgeBuilder PSType

-- | Bridges to use when a 'BridgePart' returns 'Nothing' (See 'buildBridgeWithCustomFixUp').
--
--   It is similar to BridgeBuilder but does not offer choice or failure. It is used for constructing fallbacks
--   if a 'BridgePart' evaluates to 'Nothing'.
--
--   For type definitions you should use the more generic ('MonadReader' 'BridgeData' m) constraint. This way your code will work
--   in both 'FixUpBuilder' and 'BridgeBuilder':
--
-- > {-# LANGUAGE FlexibleContexts #-}
-- >
-- > import           Control.Monad.Reader.Class
-- > import           Language.PureScript.Bridge.TypeInfo

-- >
-- > psEither :: MonadReader BridgeData m => m PSType
-- > psEither = ....
--
--   instead of:
--
-- > psEither :: BridgePart
-- > psEither = ....
--
--   or
--
-- > psEither :: FixUpBridge
-- > psEither = ....
--
newtype FixUpBuilder a = FixUpBuilder (Reader BridgeData a) deriving (Functor, Applicative, Monad, MonadReader BridgeData)

type FixUpBridge = FixUpBuilder PSType

type FullBridge = HaskellType -> PSType

data BridgeData = BridgeData {
  -- | The Haskell type to translate.
    _haskType   :: HaskellType
  -- | Reference to the bridge itself, needed for translation of type constructors.
  , _fullBridge :: FullBridge
  }

-- | By implementing the 'haskType' lens in the HasHaskType class, we are able
--   to use it for both 'BridgeData' and a plain 'HaskellType', therefore
--   you can use it with 'doCheck' and '^==' for checks on the complete 'HaskellType'
--   value.
--
--   Example:
--
-- > stringBridge :: BridgePart
-- > stringBridge = do
-- >   -- Note: we are using the HaskellType instance here:
-- >   haskType ^== mkTypeInfo (Proxy :: Proxy String)
-- >   return psString
instance HasHaskType BridgeData where
  haskType inj (BridgeData iT fB) = flip BridgeData fB <$> inj iT

-- | Lens for access to the complete bridge from within our Reader monad.
--
--   This is used for example for implementing 'psTypeParameters'.
fullBridge :: Lens' BridgeData FullBridge
fullBridge inj (BridgeData iT fB) = BridgeData iT <$> inj fB

-- | Bridge to PureScript by simply clearing out the '_typePackage' field.
--   This bridge is used by default as 'FixUpBridge' by 'buildBridge':
--
-- > buildBridge = buildBridgeWithCustomFixUp clearPackageFixUp
--
--   Thus, if no bridge matches a type, it gets optimistically translated to a PureScript type
--   which is idential to the Haskell type. Only the '_typePackage' field gets cleared,
--   as it is very unlikely that the PureScript package is called the same as the Haskell package.
--
--   Alternatively, if you are not that optimistic, you can use errorFixUp
--   - which simply calls 'error' when used.
--
-- > buildBridgeWithCustomFixUp errorFixUp yourBridge
--
--   Of course you can also write your own 'FixUpBridge'. It works the same
--   as for 'BridgePart', but you can not have choice ('<|>') or failure ('empty').
clearPackageFixUp :: MonadReader BridgeData m => m PSType
clearPackageFixUp = do
  input <- view haskType
  psArgs <- psTypeParameters
  return TypeInfo {
      _typePackage = ""
    , _typeModule  = input ^. typeModule
    , _typeName    = input ^. typeName
    , _typeParameters = psArgs
    }

-- | A 'FixUpBridge' which calles 'error' when used.
--   Usage:
--
-- > buildBridgeWithCustomFixUp errorFixUp yourBridge
errorFixUp :: MonadReader BridgeData m => m PSType
errorFixUp = do
    inType <- view haskType
    let message = "No translation supplied for Haskell type: '"
          <> inType ^. typeName <> "', from module: '"
          <> inType ^. typeModule <> "', from package: '"
          <> inType ^. typePackage <> "'!"
    return $ error $ T.unpack message

-- | Build a bridge.
--
--   This is a convenience wrapper for 'buildBridgeWithCustomFixUp' and should normally be sufficient.
--
--   Definition:
--
-- > buildBridgeWithCustomFixUp clearPackageFixUp
buildBridge :: BridgePart -> FullBridge
buildBridge = buildBridgeWithCustomFixUp clearPackageFixUp

-- | Takes a constructed BridgePart and makes it a total function ('FullBridge')
--   by using the supplied 'FixUpBridge' when 'BridgePart' returns 'Nothing'.
buildBridgeWithCustomFixUp :: FixUpBridge -> BridgePart -> FullBridge
buildBridgeWithCustomFixUp (FixUpBuilder fixUp) (BridgeBuilder bridgePart) = let
    mayBridge :: HaskellType -> Maybe PSType
    mayBridge inType = runReaderT bridgePart $ BridgeData inType bridge
    fixBridge inType = runReader fixUp $ BridgeData inType bridge
    bridge inType = fixTypeParameters $ fromMaybe (fixBridge inType) (mayBridge inType)
  in
    bridge

-- | Translate types that come from any module named "Something.TypeParameters" to lower case:
--
--   Also drop the 1 at the end if present.
--   This method gets called by 'buildBridge' and buildBridgeWithCustomFixUp for you - you should not need to call it.
--
--   It enables you to even bridge type constructor definitions, see "Language.PureScript.Bridge.TypeParameters" for more details.
fixTypeParameters :: TypeInfo lang -> TypeInfo lang
fixTypeParameters t = if "TypeParameters" `T.isSuffixOf` _typeModule t
    then t {
          _typePackage = "" -- Don't suggest any packages
        , _typeModule = "" -- Don't import any modules
        , _typeName = t ^. typeName . to (stripNum . T.toLower)
        }
    else t
  where
    stripNum v = fromMaybe v (T.stripSuffix "1" v)

-- | Alternative instance for BridgeBuilder so you can construct bridges with '<|>',
--   which behaves like a logical 'or' ('||'). If the left-hand side results in Nothing
--   the right-hand side is used, otherwise the left-hand side.
--   For usage examples see "Language.PureScript.Bridge.Primitives".
instance Alternative BridgeBuilder where
  empty = BridgeBuilder . ReaderT $ const Nothing
  BridgeBuilder a <|> BridgeBuilder b = BridgeBuilder . ReaderT $ \bridgeData -> let
          ia = runReaderT a bridgeData
          ib = runReaderT b bridgeData
        in
          ia <|> ib

instance MonadPlus BridgeBuilder where
  mzero = empty
  mplus = (<|>)

-- | Do some check on properties of 'haskType'.
doCheck :: Getter HaskellType a -> (a -> Bool) -> BridgeBuilder ()
doCheck l check = guard =<< views (haskType . l) check

-- | Check parts of 'haskType' for equality:
--
-- > textBridge :: BridgePart
-- > textBridge = do
-- >   typeName ^== "Text"
-- >   typeModule ^== "Data.Text.Internal" <|> typeModule ^== "Data.Text.Internal.Lazy"
-- >   return psString
(^==) :: Eq a => Getter HaskellType a -> a -> BridgeBuilder ()
l ^== a = doCheck l (== a)

infix 4 ^==

-- | Bridge 'haskType' 'typeParameters' over to PureScript types.
--
--   To be used for bridging type constructors.
psTypeParameters :: MonadReader BridgeData m => m [PSType]
psTypeParameters = map <$> view fullBridge <*> view (haskType . typeParameters)


text:
namespace GrizzenServer
{
    public class AgreeCmd : Cmd
    {
        public AgreeCmd(Client client) : base(client) { }

        public override void Run()
        {
            if (HasAccess)
            {
                Clients.TellScene(Scene, "Agree", Actor);
            }
        }
    }
}


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using Roslyn.Test.Utilities;
using System.Linq;
using Xunit;

namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics
{
    public class InterpolationTests : CompilingTestBase
    {
        [Fact]
        public void TestSimpleInterp()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        var number = 8675309;
        Console.WriteLine($""Jenny don\'t change your number { number }."");
        Console.WriteLine($""Jenny don\'t change your number { number , -12 }."");
        Console.WriteLine($""Jenny don\'t change your number { number , 12 }."");
        Console.WriteLine($""Jenny don\'t change your number { number :###-####}."");
        Console.WriteLine($""Jenny don\'t change your number { number , -12 :###-####}."");
        Console.WriteLine($""Jenny don\'t change your number { number , 12 :###-####}."");
        Console.WriteLine($""{number}"");
    }
}";
            string expectedOutput =
@"Jenny don't change your number 8675309.
Jenny don't change your number 8675309     .
Jenny don't change your number      8675309.
Jenny don't change your number 867-5309.
Jenny don't change your number 867-5309    .
Jenny don't change your number     867-5309.
8675309";
            CompileAndVerify(source, expectedOutput: expectedOutput);
        }

        [Fact]
        public void TestOnlyInterp()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        var number = 8675309;
        Console.WriteLine($""{number}"");
    }
}";
            string expectedOutput =
@"8675309";
            CompileAndVerify(source, expectedOutput: expectedOutput);
        }

        [Fact]
        public void TestDoubleInterp01()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        var number = 8675309;
        Console.WriteLine($""{number}{number}"");
    }
}";
            string expectedOutput =
@"86753098675309";
            CompileAndVerify(source, expectedOutput: expectedOutput);
        }

        [Fact]
        public void TestDoubleInterp02()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        var number = 8675309;
        Console.WriteLine($""Jenny don\'t change your number { number :###-####} { number :###-####}."");
    }
}";
            string expectedOutput =
@"Jenny don't change your number 867-5309 867-5309.";
            CompileAndVerify(source, expectedOutput: expectedOutput);
        }

        [Fact]
        public void TestEmptyInterp()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        Console.WriteLine($""Jenny don\'t change your number { /*trash*/ }."");
    }
}";
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (5,73): error CS1733: Expected expression
                //         Console.WriteLine("Jenny don\'t change your number \{ /*trash*/ }.");
                Diagnostic(ErrorCode.ERR_ExpressionExpected, "").WithLocation(5, 73)
                );
        }

        [Fact]
        public void TestHalfOpenInterp01()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        Console.WriteLine($""Jenny don\'t change your number { "");
    }
}";
            // too many diagnostics perhaps, but it starts the right way.
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (5,60): error CS8076: Missing close delimiter '}' for interpolated expression started with {.
                //         Console.WriteLine($"Jenny don\'t change your number { ");
                Diagnostic(ErrorCode.ERR_UnclosedExpressionHole, " {").WithLocation(5, 60),
                // (5,63): error CS1010: Newline in constant
                //         Console.WriteLine($"Jenny don\'t change your number { ");
                Diagnostic(ErrorCode.ERR_NewlineInConst, "").WithLocation(5, 63),
                // (5,66): error CS1026: ) expected
                //         Console.WriteLine($"Jenny don\'t change your number { ");
                Diagnostic(ErrorCode.ERR_CloseParenExpected, "").WithLocation(5, 66),
                // (5,66): error CS1002: ; expected
                //         Console.WriteLine($"Jenny don\'t change your number { ");
                Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(5, 66)
                );
        }

        [Fact]
        public void TestHalfOpenInterp02()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        Console.WriteLine($""Jenny don\'t change your number { 8675309 // "");
    }
}";
            // too many diagnostics perhaps, but it starts the right way.
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (5,71): error CS8077: A single-line comment may not be used in an interpolated string.
                //         Console.WriteLine("Jenny don\'t change your number \{ 8675309 // ");
                Diagnostic(ErrorCode.ERR_SingleLineCommentInExpressionHole, "//").WithLocation(5, 71),
                // (5,77): error CS1026: ) expected
                //         Console.WriteLine("Jenny don\'t change your number \{ 8675309 // ");
                Diagnostic(ErrorCode.ERR_CloseParenExpected, "").WithLocation(5, 77),
                // (5,77): error CS1002: ; expected
                //         Console.WriteLine("Jenny don\'t change your number \{ 8675309 // ");
                Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(5, 77)
                );
        }

        [Fact]
        public void TestHalfOpenInterp03()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        Console.WriteLine($""Jenny don\'t change your number { 8675309 /* "");
    }
}";
            // too many diagnostics perhaps, but it starts the right way.
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (5,60): error CS8076: Missing close delimiter '}' for interpolated expression started with {.
                //         Console.WriteLine($"Jenny don\'t change your number { 8675309 /* ");
                Diagnostic(ErrorCode.ERR_UnclosedExpressionHole, " {").WithLocation(5, 60),
                // (5,71): error CS1035: End-of-file found, '*/' expected
                //         Console.WriteLine($"Jenny don\'t change your number { 8675309 /* ");
                Diagnostic(ErrorCode.ERR_OpenEndedComment, "").WithLocation(5, 71),
                // (5,77): error CS1026: ) expected
                //         Console.WriteLine($"Jenny don\'t change your number { 8675309 /* ");
                Diagnostic(ErrorCode.ERR_CloseParenExpected, "").WithLocation(5, 77),
                // (5,77): error CS1002: ; expected
                //         Console.WriteLine($"Jenny don\'t change your number { 8675309 /* ");
                Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(5, 77)
                );
        }

        [Fact]
        public void LambdaInInterp()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        //Console.WriteLine(""jenny {0:(408) ###-####}"", new object[] { ((Func<int>)(() => { return number; })).Invoke() });
        Console.WriteLine($""jenny { ((Func<int>)(() => { return number; })).Invoke() :(408) ###-####}"");
    }

        static int number = 8675309;
    }
";
            string expectedOutput = @"jenny (408) 867-5309";
            CompileAndVerify(source, expectedOutput: expectedOutput);
        }

        [Fact]
        public void TwoInserts()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        var hello = $""Hello"";
        var world = $""world"" ;
        Console.WriteLine( $""{hello}, { world }."" );
    }
}";
            string expectedOutput = @"Hello, world.";
            CompileAndVerify(source, expectedOutput: expectedOutput);
        }

        [Fact]
        public void TwoInserts02()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        var hello = $""Hello"";
        var world = $""world"" ;
        Console.WriteLine( $@""{
                                    hello
                            },
{
                            world }."" );
    }
}";
            string expectedOutput = @"Hello,
world.";
            CompileAndVerify(source, expectedOutput: expectedOutput);
        }

        [Fact, WorkItem(306, "https://github.com/dotnet/roslyn/issues/306"), WorkItem(308, "https://github.com/dotnet/roslyn/issues/308")]
        public void DynamicInterpolation()
        {
            string source =
@"using System;
using System.Linq.Expressions;
class Program
{
    static void Main(string[] args)
    {
        dynamic nil = null;
        dynamic a = new string[] {""Hello"", ""world""};
        Console.WriteLine($""<{nil}>"");
        Console.WriteLine($""<{a}>"");
    }
    Expression<Func<string>> M(dynamic d) {
        return () => $""Dynamic: {d}"";
    }
}";
            string expectedOutput = @"<>
<System.String[]>";
            var verifier = CompileAndVerify(source, new[] { SystemCoreRef, CSharpRef }, expectedOutput: expectedOutput).VerifyDiagnostics();
        }

        [Fact]
        public void UnclosedInterpolation01()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine( $""{"" );
    }
}";
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (6,29): error CS8076: Missing close delimiter '}' for interpolated expression started with {.
                //         Console.WriteLine( $"{" );
                Diagnostic(ErrorCode.ERR_UnclosedExpressionHole, @"""{").WithLocation(6, 29),
                // (6,31): error CS1010: Newline in constant
                //         Console.WriteLine( $"{" );
                Diagnostic(ErrorCode.ERR_NewlineInConst, "").WithLocation(6, 31),
                // (6,35): error CS1026: ) expected
                //         Console.WriteLine( $"{" );
                Diagnostic(ErrorCode.ERR_CloseParenExpected, "").WithLocation(6, 35),
                // (6,35): error CS1002: ; expected
                //         Console.WriteLine( $"{" );
                Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(6, 35)
                );
        }

        [Fact]
        public void UnclosedInterpolation02()
        {
            string source =
@"class Program
{
    static void Main(string[] args)
    {
        var x = $"";";
            // The precise error messages are not important, but this must be an error.
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (5,19): error CS1010: Newline in constant
                //         var x = $";
                Diagnostic(ErrorCode.ERR_NewlineInConst, ";").WithLocation(5, 19),
                // (5,20): error CS1002: ; expected
                //         var x = $";
                Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(5, 20),
                // (5,20): error CS1513: } expected
                //         var x = $";
                Diagnostic(ErrorCode.ERR_RbraceExpected, "").WithLocation(5, 20),
                // (5,20): error CS1513: } expected
                //         var x = $";
                Diagnostic(ErrorCode.ERR_RbraceExpected, "").WithLocation(5, 20)
                );
        }

        [Fact]
        public void EmptyFormatSpecifier()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine( $""{3:}"" );
    }
}";
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (6,32): error CS8089: Empty format specifier.
                //         Console.WriteLine( $"{3:}" );
                Diagnostic(ErrorCode.ERR_EmptyFormatSpecifier, ":").WithLocation(6, 32)
                );
        }

        [Fact]
        public void TrailingSpaceInFormatSpecifier()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine( $""{3:d }"" );
    }
}";
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (6,32): error CS8088: A format specifier may not contain trailing whitespace.
                //         Console.WriteLine( $"{3:d }" );
                Diagnostic(ErrorCode.ERR_TrailingWhitespaceInFormatSpecifier, ":d ").WithLocation(6, 32)
                );
        }

        [Fact]
        public void TrailingSpaceInFormatSpecifier02()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine( $@""{3:d
}"" );
    }
}";
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
    // (6,33): error CS8088: A format specifier may not contain trailing whitespace.
    //         Console.WriteLine( $@"{3:d
    Diagnostic(ErrorCode.ERR_TrailingWhitespaceInFormatSpecifier, @":d
").WithLocation(6, 33)
                );
        }

        [Fact]
        public void MissingInterpolationExpression01()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine( $""{ }"" );
    }
}";
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (6,32): error CS1733: Expected expression
                //         Console.WriteLine( $"{ }" );
                Diagnostic(ErrorCode.ERR_ExpressionExpected, "").WithLocation(6, 32)
                );
        }

        [Fact]
        public void MissingInterpolationExpression02()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine( $@""{ }"" );
    }
}";
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (6,33): error CS1733: Expected expression
                //         Console.WriteLine( $@"{ }" );
                Diagnostic(ErrorCode.ERR_ExpressionExpected, "").WithLocation(6, 33)
                );
        }

        [Fact]
        public void MissingInterpolationExpression03()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine( ";
            var normal = "$\"";
            var verbat = "$@\"";
            // ensure reparsing of interpolated string token is precise in error scenarios (assertions do not fail)
            Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
            Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + " ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
            Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + "{").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
            Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + "{ ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
            Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
            Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat + " ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
            Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat + "{").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
            Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat + "{ ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
        }

        [Fact]
        public void MisplacedNewline01()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        var s = $""{ @""
"" }
            "";
    }
}";
            // The precise error messages are not important, but this must be an error.
            Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
        }

        [Fact]
        public void MisplacedNewline02()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        var s = $""{ @""
""}
            "";
    }
}";
            // The precise error messages are not important, but this must be an error.
            Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
        }

        [Fact]
        public void PreprocessorInsideInterpolation()
        {
            string source =
@"class Program
{
    static void Main()
    {
        var s = $@""{
#region :
#endregion
0
}"";
    }
}";
            // The precise error messages are not important, but this must be an error.
            Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
        }

        [Fact]
        public void EscapedCurly()
        {
            string source =
@"class Program
{
    static void Main()
    {
        var s1 = $"" \u007B "";
        var s2 = $"" \u007D"";
    }
}";
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (5,21): error CS8087: A '{' character may only be escaped by doubling '{{' in an interpolated string.
                //         var s1 = $" \u007B ";
                Diagnostic(ErrorCode.ERR_EscapedCurly, @"\u007B").WithArguments("{").WithLocation(5, 21),
                // (6,21): error CS8087: A '}' character may only be escaped by doubling '}}' in an interpolated string.
                //         var s2 = $" \u007D";
                Diagnostic(ErrorCode.ERR_EscapedCurly, @"\u007D").WithArguments("}").WithLocation(6, 21)
                );
        }

        [Fact, WorkItem(1119878, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1119878")]
        public void NoFillIns01()
        {
            string source =
@"class Program
{
    static void Main()
    {
        System.Console.Write($""{{ x }}"");
        System.Console.WriteLine($@""This is a test"");
    }
}";
            string expectedOutput = @"{ x }This is a test";
            CompileAndVerify(source, expectedOutput: expectedOutput);
        }

        [Fact]
        public void BadAlignment()
        {
            string source =
@"class Program
{
    static void Main()
    {
        var s = $""{1,1E10}"";
    }
}";
            CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
                // (5,22): error CS0266: Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?)
                //         var s = $"{1,1E10}";
                Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "1E10").WithArguments("double", "int").WithLocation(5, 22)
                );
        }

        [Fact]
        public void NestedInterpolatedVerbatim()
        {
            string source =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        var s = $@""{$@""{1}""}"";
        Console.WriteLine(s);
        }
    }";
            string expectedOutput = @"1";
            CompileAndVerify(source, expectedOutput: expectedOutput);
        }

        // Since the platform type System.FormattableString is not yet in our platforms (at the
        // time of writing), we explicitly include the required platform types into the sources under test.
        private const string formattableString = @"
/*============================================================
**
** Class:  FormattableString
**
**
** Purpose: implementation of the FormattableString
** class.
**
===========================================================*/
namespace System
{
    /// <summary>
    /// A composite format string along with the arguments to be formatted. An instance of this
    /// type may result from the use of the C# or VB language primitive ""interpolated string"".
    /// </summary>
    public abstract class FormattableString : IFormattable
    {
        /// <summary>
        /// The composite format string.
        /// </summary>
        public abstract string Format { get; }

        /// <summary>
        /// Returns an object array that contains zero or more objects to format. Clients should not
        /// mutate the contents of the array.
        /// </summary>
        public abstract object[] GetArguments();

        /// <summary>
        /// The number of arguments to be formatted.
        /// </summary>
        public abstract int ArgumentCount { get; }

        /// <summary>
        /// Returns one argument to be formatted from argument position <paramref name=""index""/>.
        /// </summary>
        public abstract object GetArgument(int index);

        /// <summary>
        /// Format to a string using the given culture.
        /// </summary>
        public abstract string ToString(IFormatProvider formatProvider);

        string IFormattable.ToString(string ignored, IFormatProvider formatProvider)
        {
            return ToString(formatProvider);
        }

        /// <summary>
        /// Format the given object in the invariant culture. This static method may be
        /// imported in C# by
        /// <code>
        /// using static System.FormattableString;
        /// </code>.
        /// Within the scope
        /// of that import directive an interpolated string may be formatted in the
        /// invariant culture by writing, for example,
        /// <code>
        /// Invariant($""{{ lat = {latitude}; lon = {longitude} }}"")
        /// </code>
        /// </summary>
        public static string Invariant(FormattableString formattable)
        {
            if (formattable == null)
            {
                throw new ArgumentNullException(""formattable"");
            }

            return formattable.ToString(Globalization.CultureInfo.InvariantCulture);
        }

        public override string ToString()
        {
            return ToString(Globalization.CultureInfo.CurrentCulture);
        }
    }
}

/*============================================================
**
** Class:  FormattableStringFactory
**
**
** Purpose: implementation of the FormattableStringFactory
** class.
**
===========================================================*/
namespace System.Runtime.CompilerServices
{
    /// <summary>
    /// A factory type used by compilers to create instances of the type <see cref=""FormattableString""/>.
    /// </summary>
    public static class FormattableStringFactory
    {
        /// <summary>
        /// Create a <see cref=""FormattableString""/> from a composite format string and object
        /// array containing zero or more objects to format.
        /// </summary>
        public static FormattableString Create(string format, params object[] arguments)
        {
            if (format == null)
            {
                throw new ArgumentNullException(""format"");
            }

            if (arguments == null)
            {
                throw new ArgumentNullException(""arguments"");
            }

            return new ConcreteFormattableString(format, arguments);
        }

        private sealed class ConcreteFormattableString : FormattableString
        {
            private readonly string _format;
            private readonly object[] _arguments;

            internal ConcreteFormattableString(string format, object[] arguments)
            {
                _format = format;
                _arguments = arguments;
            }

            public override string Format { get { return _format; } }
            public override object[] GetArguments() { return _arguments; }
            public override int ArgumentCount { get { return _arguments.Length; } }
            public override object GetArgument(int index) { return _arguments[index]; }
            public override string ToString(IFormatProvider formatProvider) { return string.Format(formatProvider, Format, _arguments); }
        }
    }
}
";

        [Fact]
        public void TargetType01()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        IFormattable f = $""test"";
        Console.Write(f is System.FormattableString);
    }
}";
            CompileAndVerify(source + formattableString, expectedOutput: "True");
        }

        [Fact]
        public void TargetType02()
        {
            string source =
@"using System;
interface I1 { void M(String s); }
interface I2 { void M(FormattableString s); }
interface I3 { void M(IFormattable s); }
interface I4 : I1, I2 {}
interface I5 : I1, I3 {}
interface I6 : I2, I3 {}
interface I7 : I1, I2, I3 {}
class C : I1, I2, I3, I4, I5, I6, I7
{
    public void M(String s) { Console.Write(1); }
    public void M(FormattableString s) { Console.Write(2); }
    public void M(IFormattable s) { Console.Write(3); }
}
class Program {
    public static void Main(string[] args)
    {
        C c = new C();
        ((I1)c).M($"""");
        ((I2)c).M($"""");
        ((I3)c).M($"""");
        ((I4)c).M($"""");
        ((I5)c).M($"""");
        ((I6)c).M($"""");
        ((I7)c).M($"""");
        ((C)c).M($"""");
    }
}";
            CompileAndVerify(source + formattableString, expectedOutput: "12311211");
        }

        [Fact]
        public void MissingHelper()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        IFormattable f = $""test"";
    }
}";
            CreateCompilationWithMscorlib(source).VerifyEmitDiagnostics(
                // (5,26): error CS0518: Predefined type 'System.Runtime.CompilerServices.FormattableStringFactory' is not defined or imported
                //         IFormattable f = $"test";
                Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, @"$""test""").WithArguments("System.Runtime.CompilerServices.FormattableStringFactory").WithLocation(5, 26)
                );
        }

        [Fact]
        public void AsyncInterp()
        {
            string source =
@"using System;
using System.Threading.Tasks;
class Program {
    public static void Main(string[] args)
    {
        Task<string> hello = Task.FromResult(""Hello"");
        Task<string> world = Task.FromResult(""world"");
        M(hello, world).Wait();
    }
    public static async Task M(Task<string> hello, Task<string> world)
    {
        Console.WriteLine($""{ await hello }, { await world }!"");
    }
}";
            CompileAndVerify(
                source, additionalRefs: new[] { MscorlibRef_v4_0_30316_17626, SystemRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929 }, expectedOutput: "Hello, world!");
        }

        [Fact]
        public void AlignmentExpression()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        Console.WriteLine($""X = { 123 , -(3+4) }."");
    }
}";
            CompileAndVerify(source + formattableString, expectedOutput: "X = 123    .");
        }

        [Fact]
        public void AlignmentMagnitude()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        Console.WriteLine($""X = { 123 , (32768) }."");
        Console.WriteLine($""X = { 123 , -(32768) }."");
        Console.WriteLine($""X = { 123 , (32767) }."");
        Console.WriteLine($""X = { 123 , -(32767) }."");
        Console.WriteLine($""X = { 123 , int.MaxValue }."");
        Console.WriteLine($""X = { 123 , int.MinValue }."");
    }
}";
            CreateCompilationWithMscorlib(source).VerifyDiagnostics(
                // (5,42): warning CS8094: Alignment value 32768 has a magnitude greater than 32767 and may result in a large formatted string.
                //         Console.WriteLine($"X = { 123 , (32768) }.");
                Diagnostic(ErrorCode.WRN_AlignmentMagnitude, "32768").WithArguments("32768", "32767").WithLocation(5, 42),
                // (6,41): warning CS8094: Alignment value -32768 has a magnitude greater than 32767 and may result in a large formatted string.
                //         Console.WriteLine($"X = { 123 , -(32768) }.");
                Diagnostic(ErrorCode.WRN_AlignmentMagnitude, "-(32768)").WithArguments("-32768", "32767").WithLocation(6, 41),
                // (9,41): warning CS8094: Alignment value 2147483647 has a magnitude greater than 32767 and may result in a large formatted string.
                //         Console.WriteLine($"X = { 123 , int.MaxValue }.");
                Diagnostic(ErrorCode.WRN_AlignmentMagnitude, "int.MaxValue").WithArguments("2147483647", "32767").WithLocation(9, 41),
                // (10,41): warning CS8094: Alignment value -2147483648 has a magnitude greater than 32767 and may result in a large formatted string.
                //         Console.WriteLine($"X = { 123 , int.MinValue }.");
                Diagnostic(ErrorCode.WRN_AlignmentMagnitude, "int.MinValue").WithArguments("-2147483648", "32767").WithLocation(10, 41)
                );
        }

        [WorkItem(1097388, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1097388")]
        [Fact]
        public void InterpolationExpressionMustBeValue01()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        Console.WriteLine($""X = { String }."");
        Console.WriteLine($""X = { null }."");
    }
}";
            CreateCompilationWithMscorlib(source).VerifyDiagnostics(
                // (5,35): error CS0119: 'string' is a type, which is not valid in the given context
                //         Console.WriteLine($"X = { String }.");
                Diagnostic(ErrorCode.ERR_BadSKunknown, "String").WithArguments("string", "type").WithLocation(5, 35)
                );
        }

        [Fact]
        public void InterpolationExpressionMustBeValue02()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        Console.WriteLine($""X = { x=>3 }."");
        Console.WriteLine($""X = { Program.Main }."");
        Console.WriteLine($""X = { Program.Main(null) }."");
    }
}";
            CreateCompilationWithMscorlib(source).VerifyDiagnostics(
                // (5,35): error CS1660: Cannot convert lambda expression to type 'object' because it is not a delegate type
                //         Console.WriteLine($"X = { x=>3 }.");
                Diagnostic(ErrorCode.ERR_AnonMethToNonDel, "x=>3").WithArguments("lambda expression", "object").WithLocation(5, 35),
                // (6,43): error CS0428: Cannot convert method group 'Main' to non-delegate type 'object'. Did you intend to invoke the method?
                //         Console.WriteLine($"X = { Program.Main }.");
                Diagnostic(ErrorCode.ERR_MethGrpToNonDel, "Main").WithArguments("Main", "object").WithLocation(6, 43),
                // (7,35): error CS0029: Cannot implicitly convert type 'void' to 'object'
                //         Console.WriteLine($"X = { Program.Main(null) }.");
                Diagnostic(ErrorCode.ERR_NoImplicitConv, "Program.Main(null)").WithArguments("void", "object").WithLocation(7, 35)
                );
        }

        [WorkItem(1097428, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1097428")]
        [Fact]
        public void BadCorelib01()
        {
            var text =
@"namespace System
{
    public class Object { }
    public abstract class ValueType { }
    public struct Void { }
    public struct Boolean { private Boolean m_value; Boolean Use(Boolean b) { m_value = b; return m_value; } }
    public struct Int32 { private Int32 m_value; Int32 Use(Int32 b) { m_value = b; return m_value; } }
    public struct Char { }
    public class String { }

    internal class Program
    {
        public static void Main()
        {
            var s = $""X = { 1 } "";
        }
    }
}";
            CreateCompilation(text, options: new CSharpCompilationOptions(OutputKind.ConsoleApplication))
            .VerifyEmitDiagnostics(new CodeAnalysis.Emit.EmitOptions(runtimeMetadataVersion: "x.y"),
                // (15,21): error CS0117: 'string' does not contain a definition for 'Format'
                //             var s = $"X = { 1 } ";
                Diagnostic(ErrorCode.ERR_NoSuchMember, @"$""X = { 1 } """).WithArguments("string", "Format").WithLocation(15, 21)
            );
        }

        [WorkItem(1097428, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1097428")]
        [Fact]
        public void BadCorelib02()
        {
            var text =
@"namespace System
{
    public class Object { }
    public abstract class ValueType { }
    public struct Void { }
    public struct Boolean { private Boolean m_value; Boolean Use(Boolean b) { m_value = b; return m_value; } }
    public struct Int32 { private Int32 m_value; Int32 Use(Int32 b) { m_value = b; return m_value; } }
    public struct Char { }
    public class String {
        public static Boolean Format(string format, int arg) { return true; }
    }

    internal class Program
    {
        public static void Main()
        {
            var s = $""X = { 1 } "";
        }
    }
}";
            CreateCompilation(text, options: new CSharpCompilationOptions(OutputKind.ConsoleApplication))
            .VerifyEmitDiagnostics(new CodeAnalysis.Emit.EmitOptions(runtimeMetadataVersion: "x.y"),
                // (17,21): error CS0029: Cannot implicitly convert type 'bool' to 'string'
                //             var s = $"X = { 1 } ";
                Diagnostic(ErrorCode.ERR_NoImplicitConv, @"$""X = { 1 } """).WithArguments("bool", "string").WithLocation(17, 21)
            );
        }

        [Fact]
        public void SillyCoreLib01()
        {
            var text =
@"namespace System
{
    interface IFormattable { }
    namespace Runtime.CompilerServices {
        public static class FormattableStringFactory {
            public static Bozo Create(string format, int arg) { return new Bozo(); }
        }
    }
    public class Object { }
    public abstract class ValueType { }
    public struct Void { }
    public struct Boolean { private Boolean m_value; Boolean Use(Boolean b) { m_value = b; return m_value; } }
    public struct Int32 { private Int32 m_value; Int32 Use(Int32 b) { m_value = b; return m_value; } }
    public struct Char { }
    public class String {
        public static Bozo Format(string format, int arg) { return new Bozo(); }
    }
    public class FormattableString {
    }
    public class Bozo {
        public static implicit operator string(Bozo bozo) { return ""zz""; }
        public static implicit operator FormattableString(Bozo bozo) { return new FormattableString(); }
    }

    internal class Program
    {
        public static void Main()
        {
            var s1 = $""X = { 1 } "";
            FormattableString s2 = $""X = { 1 } "";
        }
    }
}";
            var comp = CreateCompilation(text, options: Test.Utilities.TestOptions.UnsafeReleaseDll).VerifyDiagnostics();
            var compilation = CompileAndVerify(comp, verify: false);
            compilation.VerifyIL("System.Program.Main",
@"{
  // Code size       35 (0x23)
  .maxstack  2
  IL_0000:  ldstr      ""X = {0} ""
  IL_0005:  ldc.i4.1
  IL_0006:  call       ""System.Bozo string.Format(string, int)""
  IL_000b:  call       ""string System.Bozo.op_Implicit(System.Bozo)""
  IL_0010:  pop
  IL_0011:  ldstr      ""X = {0} ""
  IL_0016:  ldc.i4.1
  IL_0017:  call       ""System.Bozo System.Runtime.CompilerServices.FormattableStringFactory.Create(string, int)""
  IL_001c:  call       ""System.FormattableString System.Bozo.op_Implicit(System.Bozo)""
  IL_0021:  pop
  IL_0022:  ret
}");
        }

        [WorkItem(1097386, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1097386")]
        [Fact]
        public void Syntax01()
        {
            var text =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        var x = $""{ Math.Abs(value: 1):\}"";
        var y = x;
        }
    }
";
            CreateCompilationWithMscorlib(text).VerifyDiagnostics(
                // (6,40): error CS8087: A '}' character may only be escaped by doubling '}}' in an interpolated string.
                //         var x = $"{ Math.Abs(value: 1):\}";
                Diagnostic(ErrorCode.ERR_EscapedCurly, @"\").WithArguments("}").WithLocation(6, 40),
                // (6,40): error CS1009: Unrecognized escape sequence
                //         var x = $"{ Math.Abs(value: 1):\}";
                Diagnostic(ErrorCode.ERR_IllegalEscape, @"\}").WithLocation(6, 40)
                );
        }

        [WorkItem(1097941, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1097941")]
        [Fact]
        public void Syntax02()
        {
            var text =
@"using S = System;
class C
{
    void M()
    {
        var x = $""{ (S:
    }
}";
            // the precise diagnostics do not matter, as long as it is an error and not a crash.
            Assert.True(SyntaxFactory.ParseSyntaxTree(text).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
        }

        [WorkItem(1097386, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1097386")]
        [Fact]
        public void Syntax03()
        {
            var text =
@"using System;
class Program
{
    static void Main(string[] args)
    {
        var x = $""{ Math.Abs(value: 1):}}"";
        var y = x;
        }
    }
";
            CreateCompilationWithMscorlib(text).VerifyDiagnostics(
                // (6,18): error CS8076: Missing close delimiter '}' for interpolated expression started with '{'.
                //         var x = $"{ Math.Abs(value: 1):}}";
                Diagnostic(ErrorCode.ERR_UnclosedExpressionHole, @"""{").WithLocation(6, 18)
                );
        }

        [WorkItem(1099105, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1099105")]
        [Fact]
        public void NoUnexpandedForm()
        {
            string source =
@"using System;
class Program {
    public static void Main(string[] args)
    {
        string[] arr1 = new string[] { ""xyzzy"" };
        object[] arr2 = arr1;
        Console.WriteLine($""-{null}-"");
        Console.WriteLine($""-{arr1}-"");
        Console.WriteLine($""-{arr2}-"");
    }
}";
            CompileAndVerify(source + formattableString, expectedOutput:
@"--
-System.String[]-
-System.String[]-");
        }

        [WorkItem(1097386, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1097386")]
        [Fact]
        public void Dynamic01()
        {
            var text =
@"class C
{
    const dynamic a = a;
    string s = $""{0,a}"";
}";
            CreateCompilationWithMscorlibAndSystemCore(text).VerifyDiagnostics(
                // (3,19): error CS0110: The evaluation of the constant value for 'C.a' involves a circular definition
                //     const dynamic a = a;
                Diagnostic(ErrorCode.ERR_CircConstValue, "a").WithArguments("C.a").WithLocation(3, 19),
                // (3,23): error CS0134: 'C.a' is of type 'dynamic'. A const field of a reference type other than string can only be initialized with null.
                //     const dynamic a = a;
                Diagnostic(ErrorCode.ERR_NotNullConstRefField, "a").WithArguments("C.a", "dynamic").WithLocation(3, 23),
                // (4,21): error CS0150: A constant value is expected
                //     string s = $"{0,a}";
                Diagnostic(ErrorCode.ERR_ConstantExpected, "a").WithLocation(4, 21)
                );
        }

        [WorkItem(1099238, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1099238")]
        [Fact]
        public void Syntax04()
        {
            var text =
@"using System;
using System.Linq.Expressions;

class Program
{
    static void Main()
    {
        Expression<Func<string>> e = () => $""\u1{0:\u2}"";
        Console.WriteLine(e);
    }
}";
            CreateCompilationWithMscorlibAndSystemCore(text).VerifyDiagnostics(
                // (8,46): error CS1009: Unrecognized escape sequence
                //         Expression<Func<string>> e = () => $"\u1{0:\u2}";
                Diagnostic(ErrorCode.ERR_IllegalEscape, @"\u1").WithLocation(8, 46),
                // (8,52): error CS1009: Unrecognized escape sequence
                //         Expression<Func<string>> e = () => $"\u1{0:\u2}";
                Diagnostic(ErrorCode.ERR_IllegalEscape, @"\u2").WithLocation(8, 52)
                );
        }

        [Fact, WorkItem(1098612, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1098612")]
        public void MissingConversionFromFormattableStringToIFormattable()
        {
            var text =
@"namespace System.Runtime.CompilerServices
{
    public static class FormattableStringFactory
    {
        public static FormattableString Create(string format, params object[] arguments)
        {
            return null;
        }
    }
}

namespace System
{
    public abstract class FormattableString
    {
    }
}

static class C
{
    static void Main()
    {
        System.IFormattable i = $""{""""}"";
    }
}";
            CreateCompilationWithMscorlibAndSystemCore(text).VerifyEmitDiagnostics(
                // (23,33): error CS0029: Cannot implicitly convert type 'FormattableString' to 'IFormattable'
                //         System.IFormattable i = $"{""}";
                Diagnostic(ErrorCode.ERR_NoImplicitConv, @"$""{""""}""").WithArguments("System.FormattableString", "System.IFormattable").WithLocation(23, 33)
                );
        }
    }
}


text:
/* Generic param.h */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
 *
 * Copyright 1998-2009 The OpenLDAP Foundation.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted only as authorized by the OpenLDAP
 * Public License.
 *
 * A copy of this license is available in file LICENSE in the
 * top-level directory of the distribution or, alternatively, at
 * <http://www.OpenLDAP.org/license.html>.
 */

#ifndef _AC_PARAM_H
#define _AC_PARAM_H

#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif

#ifndef MAXPATHLEN
#	if defined(PATH_MAX)
#		define MAXPATHLEN	PATH_MAX

#	elif defined(_MAX_PATH)
#		define MAXPATHLEN	_MAX_PATH

#	else
#		define MAXPATHLEN	4096
#	endif
#endif

#endif /* _AC_PARAM_H */


text:
NGN
===

Modern OpenGL Game Engine


text:
<?xml version="1.0" encoding="UTF-8"?>
<site>
   <feature id="edu.tamu.tcat.account.sdk.feature" version="2.1.1.qualifier">
      <category name="edu.tamu.tcat.account"/>
   </feature>
   <category-def name="edu.tamu.tcat.account" label="TCAT Account Utilities">
      <description>
         A library for user accounts, including authentication and authorization.
      </description>
   </category-def>
</site>


text:
package org.eclipse.jgit.transport;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.PackFile;
import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.lib.TextProgressMonitor;
import org.eclipse.jgit.util.JGitTestUtil;

/**
 * Test indexing of git packs. A pack is read from a stream, copied
 * to a new pack and an index is created. Then the packs are tested
 * to make sure they contain the expected objects (well we don't test
 * for all of them unless the packs are very small).
 */
public class IndexPackTest extends RepositoryTestCase {

	/**
	 * Test indexing one of the test packs in the egit repo. It has deltas.
	 *
	 * @throws IOException
	 */
	public void test1() throws  IOException {
		File packFile = JGitTestUtil.getTestResourceFile("pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack");
		final InputStream is = new FileInputStream(packFile);
		try {
			IndexPack pack = new IndexPack(db, is, new File(trash, "tmp_pack1"));
			pack.index(new TextProgressMonitor());
			PackFile file = new PackFile(new File(trash, "tmp_pack1.idx"), new File(trash, "tmp_pack1.pack"));
			assertTrue(file.hasObject(ObjectId.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904")));
			assertTrue(file.hasObject(ObjectId.fromString("540a36d136cf413e4b064c2b0e0a4db60f77feab")));
			assertTrue(file.hasObject(ObjectId.fromString("5b6e7c66c276e7610d4a73c70ec1a1f7c1003259")));
			assertTrue(file.hasObject(ObjectId.fromString("6ff87c4664981e4397625791c8ea3bbb5f2279a3")));
			assertTrue(file.hasObject(ObjectId.fromString("82c6b885ff600be425b4ea96dee75dca255b69e7")));
			assertTrue(file.hasObject(ObjectId.fromString("902d5476fa249b7abc9d84c611577a81381f0327")));
			assertTrue(file.hasObject(ObjectId.fromString("aabf2ffaec9b497f0950352b3e582d73035c2035")));
			assertTrue(file.hasObject(ObjectId.fromString("c59759f143fb1fe21c197981df75a7ee00290799")));
		} finally {
			is.close();
		}
	}

	/**
	 * This is just another pack. It so happens that we have two convenient pack to
	 * test with in the repository.
	 *
	 * @throws IOException
	 */
	public void test2() throws  IOException {
		File packFile = JGitTestUtil.getTestResourceFile("pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack");
		final InputStream is = new FileInputStream(packFile);
		try {
			IndexPack pack = new IndexPack(db, is, new File(trash, "tmp_pack2"));
			pack.index(new TextProgressMonitor());
			PackFile file = new PackFile(new File(trash, "tmp_pack2.idx"), new File(trash, "tmp_pack2.pack"));
			assertTrue(file.hasObject(ObjectId.fromString("02ba32d3649e510002c21651936b7077aa75ffa9")));
			assertTrue(file.hasObject(ObjectId.fromString("0966a434eb1a025db6b71485ab63a3bfbea520b6")));
			assertTrue(file.hasObject(ObjectId.fromString("09efc7e59a839528ac7bda9fa020dc9101278680")));
			assertTrue(file.hasObject(ObjectId.fromString("0a3d7772488b6b106fb62813c4d6d627918d9181")));
			assertTrue(file.hasObject(ObjectId.fromString("1004d0d7ac26fbf63050a234c9b88a46075719d3")));
			assertTrue(file.hasObject(ObjectId.fromString("10da5895682013006950e7da534b705252b03be6")));
			assertTrue(file.hasObject(ObjectId.fromString("1203b03dc816ccbb67773f28b3c19318654b0bc8")));
			assertTrue(file.hasObject(ObjectId.fromString("15fae9e651043de0fd1deef588aa3fbf5a7a41c6")));
			assertTrue(file.hasObject(ObjectId.fromString("16f9ec009e5568c435f473ba3a1df732d49ce8c3")));
			assertTrue(file.hasObject(ObjectId.fromString("1fd7d579fb6ae3fe942dc09c2c783443d04cf21e")));
			assertTrue(file.hasObject(ObjectId.fromString("20a8ade77639491ea0bd667bf95de8abf3a434c8")));
			assertTrue(file.hasObject(ObjectId.fromString("2675188fd86978d5bc4d7211698b2118ae3bf658")));
			// and lots more...
		} finally {
			is.close();
		}
	}
}


text:
package org.hbase.async;

import org.jboss.netty.buffer.ChannelBuffer;

/**
 * An intermediate abstract class for all RPC requests that can be batched.
 *

 * This class is internal only and doesn't provide any user-facing API other
 * than guaranteeing that the RPC has a family and a timestamp.
 */
abstract class BatchableRpc extends HBaseRpc
  implements HBaseRpc.HasFamily, HBaseRpc.HasTimestamp {

  // Attributes should have `protected' visibility, but doing so exposes
  // them as part of the public API and in Javadoc, which we don't want.
  // So instead we make them package-private so that subclasses can still
  // access them directly.

  /** Family affected by this RPC.  */
  /*protected*/ final byte[] family;

  /** The timestamp to use for {@link KeyValue}s of this RPC.  */
  /*protected*/ final long timestamp;

  /**
   * Explicit row lock to use, if any.
   * @see RowLock
   */
  /*protected*/ final long lockid;

  /**
   * Whether or not this batchable RPC can be buffered on the client side.
   * Please call {@link #canBuffer} to check if this RPC can be buffered,
   * don't test this field directly.
   */
  /*protected*/ boolean bufferable = true;

  /**
   * Whether or not the RegionServer must write to its WAL (Write Ahead Log).
   */
  /*protected*/ boolean durable = true;

  /**
   * Package private constructor.
   * @param table The name of the table this RPC is for.
   * @param row The name of the row this RPC is for.
   * @param family The column family to edit in that table.  Subclass must
   * validate, this class doesn't perform any validation on the family.
   * @param timestamp The timestamp to use for {@link KeyValue}s of this RPC.
   * @param lockid Explicit row lock to use, or {@link RowLock#NO_LOCK}.
   */
  BatchableRpc(final byte[] table,
               final byte[] key, final byte[] family,
               final long timestamp, final long lockid) {
    super(table, key);
    this.family = family;
    this.timestamp = timestamp;
    this.lockid = lockid;
  }

  /**
   * Sets whether or not this RPC is can be buffered on the client side.
   * The default is {@code true}.
   *

   * Setting this to {@code false} bypasses the client-side buffering, which
   * is used to send RPCs in batches for greater throughput, and causes this
   * RPC to be sent directly to the server.
   * @param bufferable Whether or not this RPC can be buffered (i.e. delayed)
   * before being sent out to HBase.
   * @see HBaseClient#setFlushInterval
   */
  public final void setBufferable(final boolean bufferable) {
    this.bufferable = bufferable;
  }

  /**
   * Changes the durability setting of this edit.
   * The default is {@code true}.
   * Make sure you've read and understood the
   * data durability section before
   * setting this to {@code false}.
   * @param durable Whether or not this edit should be stored with data
   * durability guarantee.
   */
  public final void setDurable(final boolean durable) {
    this.durable = durable;
  }

  @Override
  public final byte[] family() {
    return family;
  }

  @Override
  public final long timestamp() {
    return timestamp;
  }

  // ---------------------- //
  // Package private stuff. //
  // ---------------------- //

  /** Returns whether or not it's OK to buffer this RPC on the client side. */
  final boolean canBuffer() {
    // Don't buffer edits that have a row-lock, we want those to
    // complete ASAP so as to not hold the lock for too long.
    return bufferable;
  }

  // ----------------------------------------------- //
  // Serialization helpers for HBase 0.94 and before //
  // ----------------------------------------------- //

  /**
   * Serialization version for this RPC.
   * Only used when this RPC is serialized as part of a {@link MultiAction}.
   * @param server_version What RPC protocol version the server is running.
   */
  abstract byte version(final byte server_version);

  /** HBase code type for this kind of serialized RPC.  */
  abstract byte code();

  /**
   * How many {@link KeyValue}s will be serialized by {@link #serializePayload}.
   */
  abstract int numKeyValues();

  /**
   * An estimate of the number of bytes needed for {@link #serializePayload}.
   * The estimate is conservative.
   */
  abstract int payloadSize();

  /**
   * Serialize the part of this RPC for a {@link MultiAction}.
   */
  abstract void serializePayload(final ChannelBuffer buf);

}


text:
<meta>
	<info description="Script collection" version="1.0" author="MasterWayZ" type="script"/>

	<script src="s_admin.lua" type="server"/>

	<script src="perms.lua" type="server"/>
	<script src="perms.lua" type="client"/>

	<script src="ia/perms.lua" type="server"/>
	<script src="ia/perms.lua" type="client"/>

        <script src="c_logs.lua" type="client"/>

	<script src="ia/s_warn.lua" type="server"/>

	<export type="server" function="isPlayerMasterWayZ"/>
	<export type="client" function="isPlayerMasterWayZ"/>
	<export type="server" function="isPlayerAllowed"/>
	<export type="client" function="isPlayerAllowed"/>
	<export type="server" function="isPlayerInternalAffairs"/>
        <export type="client" function="isPlayerInternalAffairs"/>
</meta>


text:
Changelog
====

## 3.7.0

- added `offset` prop ([#64](https://github.com/joshwnj/react-visibility-sensor/pull/64))

## 3.6.2

- fixed a problem where `.debounceCheck` is not cleared properly ([#62](https://github.com/joshwnj/react-visibility-sensor/pull/62))

## 3.6.1

- fixed typo from `delay` to `scrollDelay` ([#59](https://github.com/joshwnj/react-visibility-sensor/pull/59))

## 3.6.0

- added support for "scrollCheck" as well as the default "intervalCheck" ([#54](https://github.com/joshwnj/react-visibility-sensor/pull/54))

## 3.5.0

- simpler logic for `partialVisible` ([#41](https://github.com/joshwnj/react-visibility-sensor/pull/41))

## 3.4.0

- `partialVisibility` prop can now either be a `boolean` (any edge can be visible) or a string of `top|right|bottom|left` to indicate which edge determines visibility ([#42](https://github.com/joshwnj/react-visibility-sensor/pull/42/files))

## 3.3.0

- Mark partially visible when center is visible ([#40](https://github.com/joshwnj/react-visibility-sensor/pull/40))

## 3.2.1

- Fixed error case where component can be null ([#38](https://github.com/joshwnj/react-visibility-sensor/pull/38))

## 3.2.0

- Added `minTopValue` and `delayedCall` props ([#30](https://github.com/joshwnj/react-visibility-sensor/pull/30))

## 3.1.1

- Removed dist file from git (as suggested in #18)
- Added `npm run build`, which is also run on prepublish
- updated the build script so browserify produces a standalone umd script
- added `example-umd` to show how to use it with plain `<script>` tags

## 3.0.1

- return the new state from `.check` method

## 3.0.0

- upgraded to react 0.14
- removed the `package.browserify` field, which is no longer needed and was causing some conflicts ([#11](https://github.com/joshwnj/react-visibility-sensor/issues/11))

## 2.1.0

- new optional prop `partialVisibility` changes the behaviour of the sensor, so that it considers an element to be visible if it is at least partially visible ([#15](https://github.com/joshwnj/react-visibility-sensor/pull/15))

## 2.0.0

- sensor DOM node is passed in as children rather than the component always rendering its own `<div>` ([#13](https://github.com/joshwnj/react-visibility-sensor/pull/13))
- this also means the component also no longer accepts `className` or `style` props.

### Migrating from `v1.x`:

If you're not setting a `className` or `style`, no change is required.

Otherwise add your own element as a child and move the `className` or `style` there.  Eg:

- before: `<VisibilitySensor className='something' />`
- after: `<VisibilitySensor><div className='something' /></VisibilitySensor>`


text:
using System.Runtime.InteropServices;
using GodLesZ.Library.Win7.Shell.PropertySystem;

namespace GodLesZ.Library.Win7.Shell {
	/// <summary>
	/// Stores information about how to sort a column that is displayed in the folder view.
	/// </summary>
	[StructLayout(LayoutKind.Sequential)]
	public struct SortColumn {

		/// <summary>
		/// Creates a sort column with the specified direction for the given property.
		/// </summary>
		/// <param name="propertyKey">Property key for the property that the user will sort.</param>
		/// <param name="direction">The direction in which the items are sorted.</param>
		public SortColumn(PropertyKey propertyKey, SortDirection direction)
			: this() {
			this.propertyKey = propertyKey;
			this.direction = direction;
		}

		/// <summary>
		/// The ID of the column by which the user will sort. A PropertyKey structure.
		/// For example, for the "Name" column, the property key is PKEY_ItemNameDisplay or
		/// <see cref="GodLesZ.Library.Win7.Shell.PropertySystem.SystemProperties.System.ItemName"/>.
		/// </summary>
		public PropertyKey PropertyKey { get { return propertyKey; } set { propertyKey = value; } }
		private PropertyKey propertyKey;

		/// <summary>
		/// The direction in which the items are sorted.
		/// </summary>
		public SortDirection Direction { get { return direction; } set { direction = value; } }
		private SortDirection direction;

		/// <summary>
		/// Implements the == (equality) operator.
		/// </summary>
		/// <param name="col1">First object to compare.</param>
		/// <param name="col2">Second object to compare.</param>
		/// <returns>True if col1 equals col2; false otherwise.</returns>
		public static bool operator ==(SortColumn col1, SortColumn col2) {
			return (col1.direction == col2.direction) &&
				(col1.propertyKey == col2.propertyKey);
		}

		/// <summary>
		/// Implements the != (unequality) operator.
		/// </summary>
		/// <param name="col1">First object to compare.</param>
		/// <param name="col2">Second object to compare.</param>
		/// <returns>True if col1 does not equals col1; false otherwise.</returns>
		public static bool operator !=(SortColumn col1, SortColumn col2) {
			return !(col1 == col2);
		}

		/// <summary>
		/// Determines if this object is equal to another.
		/// </summary>
		/// <param name="obj">The object to compare</param>
		/// <returns>Returns true if the objects are equal; false otherwise.</returns>
		public override bool Equals(object obj) {
			if (obj == null || obj.GetType() != typeof(SortColumn)) { return false; }
			return (this == (SortColumn)obj);
		}

		/// <summary>
		/// Generates a nearly unique hashcode for this structure.
		/// </summary>
		/// <returns>A hash code.</returns>
		public override int GetHashCode() {
			int hash = this.direction.GetHashCode();
			hash = hash * 31 + this.propertyKey.GetHashCode();
			return hash;
		}

	}

}


text:
package org.apache.wicket.model;

import java.io.Serializable;

import org.apache.wicket.Component;
import org.apache.wicket.WicketTestCase;
import org.apache.wicket.behavior.AbstractBehavior;
import org.apache.wicket.markup.html.WebMarkupContainer;

/**
 * @author Pedro Santos
 */
public class DetachableTest extends WicketTestCase
{

	/**
	 * WICKET-3872
	 */
	public void testDetachRemovedChildrenTree()
	{
		DetachableComponent a = new DetachableComponent("a");
		DetachableComponent ab = new DetachableComponent("b");
		DetachableComponent ac = new DetachableComponent("c");
		DetachableComponent abd = new DetachableComponent("d");
		DetachableModel detachableModel = new DetachableModel();
		DetachableBehavior detachableBehavior = new DetachableBehavior();
		abd.setDefaultModel(detachableModel);
		abd.add(detachableBehavior);

		a.add(ab);
		a.add(ac);
		ab.add(abd);
		a.removeAll();

		assertFalse(a.detached);
		assertTrue(ab.detached);
		assertTrue(ac.detached);
		assertTrue(abd.detached);
		assertTrue(detachableModel.detached);
		assertTrue(detachableBehavior.detached);
	}

	private class DetachableComponent extends WebMarkupContainer
	{
		private boolean detached;

		private DetachableComponent(String id)
		{
			super(id);
		}

		@Override
		protected void onDetach()
		{
			super.onDetach();
			detached = true;
		}
	}

	private class DetachableModel extends Model<Serializable>
	{
		private boolean detached;

		@Override
		public void detach()
		{
			detached = true;
		}
	}

	private class DetachableBehavior extends AbstractBehavior
	{
		private boolean detached;

		@Override
		public void detach(Component component)
		{
			detached = true;
		}
	}
}